trying jigsaw-ea-95 jlink
Sebastian Sickelmann
sebastian.sickelmann at gmx.de
Sat Dec 12 17:47:26 UTC 2015
Hi I am trying to work with jlink, and do not get it working. What I am
doing wrong?
My compiled modules(not jars, but exploded in the filesystem) are at the
directory mymods
I can start my programm via
sebastian at Inspi:~/example1$ ~/jigsaw-ea-95/bin/java -mp mymods -m
demo.app/demo.app.Example1
<output-of-programm>
The mymods directory has the following structure
sebastian at Inspi:~/example1$ du --si mymods
8.2k mymods/demo.app/demo/app
13k mymods/demo.app/demo
21k mymods/demo.app
8.2k mymods/demo.lib/demo/lib
13k mymods/demo.lib/demo
21k mymods/demo.lib
46k mymods
If i now try to create a distribution with jlink, i add my module
demo.app and declare mymods and the jmod dir as modulepath
sebastian at Inspi:~/example1$ ~/jigsaw-ea-95/bin/jlink --modulepath
mymods:/home/sebastian/jigsaw-ea-95/jmods --addmods demo.app --output
jlink-ea
I can list the modules that are included in the resulting distribution
sebastian at Inspi:~/example1$ jlink-ea/bin/java -listmods
demo.app
demo.lib
java.base at 9-ea
But I am not able to start my programm
sebastian at Inspi:~/example1$ jlink-ea/bin/java -m demo.app/demo.app.Example1
Error: Could not find or load main class demo.app.Example1 in module
demo.app
To be sure not to made a typing error i tried
sebastian at Inspi:~/example1$ jlink-ea/bin/java -m
demo.app.not.existing/demo.app.Example1
Error occurred during initialization of VM
java.lang.module.ResolutionException: Module demo.app.not.existing not found
at java.lang.module.Resolver.fail(java.base at 9-ea/Resolver.java:860)
at java.lang.module.Resolver.resolve(java.base at 9-ea/Resolver.java:291)
at
java.lang.module.Configuration.resolve(java.base at 9-ea/Configuration.java:246)
at
jdk.internal.module.ModuleBootstrap.boot(java.base at 9-ea/ModuleBootstrap.java:188)
at java.lang.System.initPhase2(java.base at 9-ea/System.java:1911)
But it seemed that I am not able to type a wrong module name. So there
is no typing error there.
And if I just want to start my module (without a startup-class)
sebastian at Inspi:~/example1$ jlink-ea/bin/java -m demo.app
module demo.app does not have a MainClass attribute, use -m
<module>/<main-class>
It says that java does not find the MainClass (as expected)
What I am doing wrong?
Thanks for your help.
--
Sebastian
More information about the jigsaw-dev
mailing list