after installing jdk7u5 for mac os I got different java-versions for “normal” user and root.
java -version
gives me the 7.
sudo java -version
gives me the 6.
I’ve looked up in the
/System/Library/Frameworks/JavaVM.framework/Versions/
found that there are some links. After I resolved the links to the real Directory I tried it again with the whole path.
/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java -version
-> 7
sudo /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java -version
-> 6
Same with javac!
Hope you guys could help me!
Advertisement
Answer
Under OSX /usr/bin/java locates the java version to be used by looking at what you chose using /Applications/Utilities/Java Preferences.app
. The files ths uses are also updated by the Oracle updater.
As you have to drag the versions manually to set Java 1.7 you will have only set this for the user you run it as ie not root. To set it for root I ran the app as sudo /Applications/Utilities/Java Preferences.app/Contents/MacOS/Java Preferences
and moved 1.7 to the top.
As far as I can see the files the app updates are in ~/Library/Preferences/ByHost/com.apple.java.JavaPreferences.<hex number>.plist
where <hex number>
is machine related. Root’s home directory is /var/root so I now have /var/root/Library/Preferences/ByHost/com.apple.java.JavaPreferences.<hex number>.plist