I'm trying to make my .jar file with the javafx stuff into an executable application, but when I try to do jpackage on the command line, I'm getting command not found. I've downloaded the latest jdk-15.0.1_osx-x64_bin.dmg from Oracle.
Asked
Active
Viewed 861 times
1 Answers
4
Although some Java commands are defined (eg java, javac) And are in the local /usr/bin directory, they only contain commands that were in the Java 6 release (including eg appletviewer).
Newer commands that were added in later Java releases like jmod, jlink etc aren’t available in the path. I’ve raised a radar (bug) at Apple a few years ago And the response was “so?” — don’t hold your breath.
To run these commands you will need to add the Home/bin directory of your install (under /Library/Java/JavaVirtual/Machines) to your PATH environment variable. You can also use /usr/libexec/java_home to find the path of the installed JVM automatically.

AlBlue
- 23,254
- 14
- 71
- 91
-
Thanks for your reply! I've found the Home/bin directory. How would I add it to my PATH environment variable? Is that the same as setting my JAVA_HOME? I'm not sure my google-fu is up to scratch re: learning how to do things in java – Denton Lister Feb 07 '21 at 10:15
-
2The path is a Unix thing, not a Java thing :-) What you’ll need to do is to have PATH=$PATH:/Library/Java/.../bin and then you’ll be able to run any of them from that directory. If you are using zsh as the terminal shell you can put this line in a file called .zshrc in your home directory — if you are using an older Mac with bash you need .bashrc – AlBlue Feb 07 '21 at 10:18
-
I've just updated to zsh and opened my ~/.zshrc file, which was completely empty, and added PATH=$PATH:/Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home/bin to it. (Should I copy over everything I had in my bash_profile file to the zshrc file?) I then tried jpackage on the command line again and still am getting command not found? – Denton Lister Feb 07 '21 at 10:38
-
Oh! I added the same line to my bash_profile file and now it's found jpackage! – Denton Lister Feb 07 '21 at 10:41
-
Great. If this answer has helped you can accept it by clicking the tick next to the upvote/downvote buttons – AlBlue Feb 07 '21 at 10:43