-jar option and the modulepath

Alan Bateman Alan.Bateman at oracle.com
Fri Nov 23 08:06:23 UTC 2018

On 22/11/2018 19:27, Richard Hillegas wrote:
> Can I scribble something in a jar file manifest which will cause "java 
> -jar" to boot with a modulepath rather than a classpath? I do not see 
> any support for a modulepath attribute in the Java 9 jar file 
> documentation at 
> https://docs.oracle.com/javase/9/docs/specs/jar/jar.html. My sense is 
> that the -jar option commits the JVM to using a classpath.
There is no support for executable modular JARs at this time. It's part 
of a bigger topic that is tracked as #MultiModuleExecutableJARs. Some 
prototypes during JDK 9 but the decision at the time was to defer it to 
some future effort. So when you run with `java -jar` then it puts the 
JAR file on the class path (exactly as it did in all previous releases).


More information about the core-libs-dev mailing list