I'm trying to get started using jlink on Java 9. I've installed Java 9 on my Mac and for example, jshell runs just fine. However, when I go to use jlink I get jlink: command not found. Does anybody have any idea what might being going wrong? I don't even know what to check. After all, if jshell runs fine then I must have jdk 9 installed??
2 Answers
This isn't an issue with your installation, it has to be added manually as it's not included in the path by default.
This is an intentional decision according to the O'Reilly Java 9 Modularity book, which notes that this is the case but doesn't provide an explanation as to why this decision was made.
jlink can be added to your path like any executable by adding this snippet to your .bashrc or equivalent:
export PATH="$JAVA_HOME/bin:$PATH"
, use the full path if $Java_Home
isn't set.
I found the problem. While I still don't know why jlink wasn't automatically added to a PATH-directory like, say, jshell was, the solution was as simple as locating the jlink executable. It was in the location of /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin
, so I just added that to my path in my .bash_profile file… still, I have no idea why any of this was necessary.