JAVA_HOME on Mac OS X

June 26, 2008 Alex Chaffee

For the millionth time, cause I always forget…

Put this in ~/.bashrc:

export JAVA_HOME=/Library/Java/Home

[UPDATE: or this, which according to Mike Swingler, follows the Java version chosen in Java Preferences:

export JAVA_HOME=`/usr/libexec/java_home`

]

Also, run “sudo visudo” and add the line

Defaults        env_keep += "JAVA_HOME"

or else commands like “sudo gem install” won’t be able to find Java.

Without the above, I got the following error (which seemed to have been run through a baby-talk filter) when running “sudo gem install rjb”:

extconf.rb:44: JAVA_HOME is not setted. (RuntimeError)

About the Author

Biography

More Content by Alex Chaffee
Previous
Ding
Ding

Head's up... I'm back on Monday!

Next
Build Your Own Rails Plugin Platform with Desert
Build Your Own Rails Plugin Platform with Desert

While it is easy to include plugins in your Rails projects, it isn't easy to extend and customize the plugi...

Enter curious. Exit smarter.

Register Now