I am getting this Error: Module java.base not found
while trying to use jlink.
These are the 2 things I have tried so far
/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/jlink --module-path "%JAVA_HOME%\jmods":mods --add-modules com.tutorialspoint.greetings,java.base --output customjre
Error: Module java.base not found
/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/jlink --module-path "%JAVA_HOME%\jmods":mods --add-modules com.tutorialspoint.greetings,[email protected] --output customjre
Error: Module [email protected] not found
My module contains this.
module com.tutorialspoint.greetings {
requires java.base;
}
I followed this tutorial for making modules exactly except I added the requires java.basic. https://www.tutorialspoint.com/java9/java9_module_system.htm
I tried it without requires java.base and still get the same problem. Any ideas? I am new to JLink and Java9 and wanted to try it since java8 doesn't have Jlink.
Maybe it's how I am referencing to JLink in the directory itself?
The problem comes from the fact that the path of the module is poorly defined.
If you are on macos, the correct syntax is:
Make sure the
JAVA_HOME
variable is set before running thejlink
.Also, it is not necessary to define the requires clause with the
java.base
module in your module because thejava.base
module is implicitly added in all modules.