External library folder for Spring Boot
CLASSPATH and -classpath will not be working in case of running Spring boot jar file. So there are below options are available:
Use -Dloader.path e.g. java -cp MyOwn.jar -Dloader.path=C:\Sandeep\lib -Dconsole.level=INFO -Dloader.main=abc.Main org.springframework.boot.loader.PropertiesLauncher --spring.config.name=application
Another option to place other jars into the JRE/lib/ext directory
Third option, open Spring Boot Jar with WinRAR application and add the jar file into the Spring Boot jar
See the documentation about PropertiesLauncher:
- https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html#executable-jar-property-launcher-features
Looks like you can use the loader.path
property to define a lib folder location, containing jars to load - in fact the lib folder (inline with the jar) is the default location:
loader.path (if empty) defaults to lib (meaning a local directory or a nested one if running from an archive)