You can use the loader.path parameter to determine the location for the external lib folder. All banks in this folder will be added to the classpath. For example, if you want to define C: \ extLib as your external lib folder, you can do the following:
java -Dloader.path=/C:/extLib/ -jar aapName.jar
For this to work, you need to use PropertiesLauncher. There are two ways to do this:
Option 1
Update the pom.xml project and add the following tag:
<configuration> <layout>ZIP</layout> </configuration
Effective build tag, post update looks like this:
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <layout>ZIP</layout> </configuration> </plugin> </plugins> </build>
Option 2
Use PropertiesLauncher when starting the application from the command line:
java -cp aapName.jar -Dloader.path=/C:/extLib/ org.springframework.boot.loader.PropertiesLauncher
Links: https://mash213.wordpress.com/2017/01/05/hack-how-2-add-jars-2-springboot-classpath-with-jarlauncher/
source share