Reputation: 427
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?
Upvotes: 1
Views: 2188
Reputation: 2122
The solution that worked for me was to just Upgrade AGP.
Tools->AGP Upgrade Assistant
Use the latest version
Upvotes: 1
Reputation: 1
The problem comes from the fact that the path of the module is poorly defined.
If you are on macos, the correct syntax is:
jlink --module-path "mods:$JAVA_HOME/jmods" --add-modules com.tutorialspoint.greetings --output customjre
Make sure the JAVA_HOME
variable is set before running the jlink
.
Also, it is not necessary to define the requires clause with the java.base
module in your module because the java.base
module is implicitly added in all modules.
Upvotes: 0