Created
November 14, 2011 02:34
-
-
Save Atalanta/1363108 to your computer and use it in GitHub Desktop.
Finding JAVA_HOME on OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
java_dir = %x[ls -l $(which java)].split.last | |
java_home_command = java_dir.gsub('java', 'java_home') | |
print "JAVA_HOME is: " | |
java_home = system(java_home_command) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is also a command (
/usr/libexec/java_home
) from Lion down to Leopard (possibly lower) that can tell you what JAVA_HOME has been set to. https://github.com/fnichol/bashrc/blob/master/bashrc#L156-158