I installed the release version of JDK 9 on Mac OS.
jshell works great, Jigsaw module support works, but there is no jlink:
➜ java --version
java 9
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
This comes up empty:
find /System/Library/Frameworks/JavaVM.framework/Versions/Current/ -iname jlink\*
FYI:
➜ ls -l $(which java)
lrwxr-xr-x 1 root wheel 74 Nov 7 2016 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
Jlink is a Java command line tool that is used to generate a custom Java runtime environment (JRE). You can use your customized JRE to run Java applications. Using jlink, you can create a custom runtime environment that only includes the relevant class file.
To create a runtime image with jlink you need to specify the root modules with --add-modules - starting with these modules, jlink will build a module graph and include all resolved modules in the new image. You have used --add-modules com. spacey.
Many Adobe applications depend on the Oracle Java Runtime Environment (JRE) for some features to work. Apple recently changed the way it includes Java in Mac OS, and with Lion, Java is no longer preinstalled. It is now an optional install that you must select.
You can verify your JAVA_HOME
using which java
and make sure it points to the default installation path which ideally should be
/Library/Java/JavaVirtualMachines...
[for e.g. I use it as export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/
]
and further you can find the jlink
in the bin folder of Contents
find /Library/Java/JavaVirtualMachines/jdk-9.jdk -iname jlink\*
which should return
/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin
Attaching a screenshot for reference of the location its installed:-
Note: Though in the screenshot, the command doesn't run successfully but its recognized.
To add the JDK 9 tools to your path, add the following to the file .bashrc
of your home directory:
export JAVA_HOME=$(/usr/libexec/java_home -v 9)
export PATH="$JAVA_HOME/bin:$PATH"
Did you notice the -v 9
? you can change that to 1.8 if you ever want to switch back to JDK 1.8. For any newbie who can’t locate .bashrc
in the Finder: press ⌘⇧. (command shift dot) to reveal hidden files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With