1

How can i use a /path/test-*.jar kind of path in spring boot app launch with -Dloader.path args. I tried to do

java -Dserver.port=8090 -Dloader.path=/path/test*.jar, myJar.jar  -jar myJar.jar   org.springframework.boot.loader.PropertiesLauncher

but it throws the following exception:

java.lang.IllegalArgumentException: File must exist
    at org.springframework.boot.loader.data.RandomAccessDataFile.<init>(RandomAccessDataFile.java:67)
    at org.springframework.boot.loader.data.RandomAccessDataFile.<init>(RandomAccessDataFile.java:51)
    at org.springframework.boot.loader.jar.JarFile.<init>(JarFile.java:95)
    at org.springframework.boot.loader.archive.JarFileArchive.<init>(JarFileArchive.java:61)
    at org.springframework.boot.loader.archive.JarFileArchive.<init>(JarFileArchive.java:57)
    at org.springframework.boot.loader.PropertiesLauncher.getArchive(PropertiesLauncher.java:492)
    at org.springframework.boot.loader.PropertiesLauncher.getClassPathArchives(PropertiesLauncher.java:469)
    at org.springframework.boot.loader.PropertiesLauncher.getClassPathArchives(PropertiesLauncher.java:444)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:60)
    at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:609)

Or is it that it either has to be absolute path to a directory or a jar??

pratim_b
  • 1,160
  • 10
  • 29

1 Answers1

0

As stated in the documentation

can contain directories (scanned recursively for jar and zip files), archive paths, or wildcard patterns (for the default JVM behavior).

You'll have to put your test*-.jar in a directory and add the reference to that directory.

Stephane Nicoll
  • 31,977
  • 9
  • 97
  • 89
  • its already in a directory. if i give the path to directory , it works. but if i use wildcards, it does not. Why i am using wildcards: coz i dont want all the jars in that directory to be loaded – pratim_b Aug 05 '15 at 08:30
  • but the doc says, it can contain wildcard patterns – pratim_b Aug 05 '15 at 08:36
  • the _(for the default JVM behaviour)_ part is important. See [this thread](http://stackoverflow.com/questions/1237093/how-to-use-a-wildcard-in-the-classpath-to-add-multiple-jars) for what "default JVM behaviour" means. – Stephane Nicoll Aug 05 '15 at 08:45
  • If you are using bash you can use its pattern matching to resolve the wildcards – joshiste Aug 05 '15 at 16:02