Mac OSX 10.11.14 (El Capatin) does not ship with Java, either the complete development kit (JDK) or the run-time environment (JRE). My need was to just run a .jar file and not for complete Java development. So I downloaded the JRE from here , which is a much smaller file compared to JDK (quite obviously).
This SO answer says that JRE is enough to run jar files.
After installation of JRE I couldn't locate the directory where installation happened or run java
command to execute files on my mac. How do I run jar files now?
To run java application you can either use
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
or (as you found)
/Library/Internet\\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
In any case, if you need to run java often, you should set JAVA_HOME in either your ~/.bash_profile
or ~/.profile
and amend the PATH to include the bin directory.
After JRE installation, the correct path is:
/Library/Internet\\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin
But now, how do I run the java
command? It seems like the java file located in the directory above is not an executable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.