Just do this from the command line:Īnd use the result. If so, then the Apple system programmers may have done you a favor and provided a handy little command called ' java_home' that returns the value you need. So if JAVA_HOME isn't already set, your next task is to find the directory to which you need to set it. For linux users, it is almost certainly not the same directory that you get if you do ' which java' from the command line, because that would be too easy. The JAVA_HOME environment variable needs to point to the installation directory on your system that contains the bin/ directory where the java executable physically resides, and the lib/ directory which contains the core java libraries and properties files. If the answer is a directory path, you're good to go.
To check, on the Windows command line do: Sometimes your JAVA_HOME environment variable will already be set for other reasons.