Java 8 on OS X El Capitan with command-line support
Here's a quick tip if you want to install Java to be able to run Java apps from the command-line on OS X.
Intuitively, installing the JRE appears to be the obvious choice, as you're not bothered about javac
or other developer tools. However, the JRE DMG package doesn't register itself as a full JVM, merely a "Internet Plug-In". It'll allow you to run GUI applications that use Java, but it will still result in a prompt to download a JVM if you run java
from a terminal. This is because the JRE is installed into /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
, but /usr/bin/java
only looks for JVMs in /Library/Java/JavaVirtualMachines
.
Instead, download the Oracle JDK - this installs itself into /Library/Java/JavaVirtualMachines
and therefore can be used from both the command-line and from GUI apps.