I am following through a Java textbook, and is stuck when running some example code that uses Jlink to "create a runtime image" of a group of modules.
I have a directory structure that looks kind of like this, with appfuncs
and appstart
being 2 modules that I have defined where appstart
requires the appfuncs module, and appstart
also contains the point of entry main class, MyModAppDemo.java.
When I run the jLink command below, i get an error that says that the mymodapp module cannot be loaded.
jlink --launcher MyModApp=appstart/appstart.mymodappdemo.MyModAppDemo --module-path "%JAVA_HOME%"\jmods;mymodapp\appmodules --add-modules appstart --output mylinkedmodapp
I hope to get some idea of what this error is about, if I am missing something that is really fundamental I am really sorry, I'm not very proficient with Java.
What you're seeing is a powershell error, not a Java error.
The issue is that in powershell,
;
is used to delimit commands. To prevent that, you need to use quotes. Furthermore, you can't use%JAVA_HOME%
in powershell to access environment variables. You need to use$Env:JAVA_HOME
instead. This should work: