Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to run a server that requires Java 7 using terminal. After installing Java 7, typing java -version in terminal still shows Java 6. Previously, I would use the Java Preferences application, but Apple has removed it. Does anyone have any idea how to change the Java version the system uses without the Java Preferences application? Or if anyone knows a download link for Java Preferences, that would be greatly appreciated as I am able to achieve the same results by just using that. Thank you so much!

I am using the latest version of Mac OS X

share|improve this question

migrated from Dec 24 '12 at 8:26

This question came from our site for professional and enthusiast programmers.

Type which java and see where it's loading Java from. Maybe you installed a separate copy somewhere and that's in your path. – Marvo Dec 24 '12 at 0:59
Um, with Java Preferences you mean the Java Control Panel window you could once call from either Utilites or System Preferences? With 1.7 it's in System Preferences.. – dbf Dec 24 '12 at 1:17
Spotlight :) command-space then type java preferences, it has not been removed. – Brian Roach Dec 24 '12 at 1:30

1 Answer 1

export JAVA_HOME="/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home"

Try entering that line in terminal. You can also type- java -version to see which version is currently running.

I've had to do the exact opposite as you, revert to Java 1.6 after having 1.7 installed.

This is old but provides some background that may help lead you on the right path:

Just beware that this situation can be a bit of a head ache to solve...!

share|improve this answer
Alternatively to exporting JAVA_HOME, one may run sudo echo "/Library/Java/... path ..." > /etc/paths.d/jdk1.7.0_09 – ignis Dec 24 '12 at 1:27
In my case, the path ends with /bin (i.e. /Library/Java/JavaVirtualMachines/jdk1.7.0.jdk/Contents/Home/bin) – ignis Dec 24 '12 at 1:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.