trying jigsaw-ea-95 jlink

Sebastian Sickelmann sebastian.sickelmann at
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

The mymods directory has the following structure
sebastian at Inspi:~/example1$ du --si mymods
8.2k    mymods/
13k    mymods/
21k    mymods/
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 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 --output

I can list the modules that are included in the resulting distribution
sebastian at Inspi:~/example1$ jlink-ea/bin/java -listmods
java.base at 9-ea

But I am not able to start my programm
sebastian at Inspi:~/example1$ jlink-ea/bin/java -m
Error: Could not find or load main class in module

To be sure not to made a typing error i tried
sebastian at Inspi:~/example1$ jlink-ea/bin/java -m
Error occurred during initialization of VM
java.lang.module.ResolutionException: Module not found
    at at 9-ea/
    at java.lang.module.Resolver.resolve(java.base at 9-ea/
java.lang.module.Configuration.resolve(java.base at 9-ea/
jdk.internal.module.ModuleBootstrap.boot(java.base at 9-ea/
    at java.lang.System.initPhase2(java.base at 9-ea/

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
module does not have a MainClass attribute, use -m

It says that java does not find the MainClass (as expected)

What I am doing wrong?

Thanks for your help.


More information about the jigsaw-dev mailing list