Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updating Java on Mac - despite updating java -version still = 1.6

 
Alvin Watkins
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sure this is a very simple issue but I'm not versed in Mac and am having some issues updating Java.

I am debugging an application that is having troubles on Mac. The first step I'd like to take is to update from Java 6 to Java 7 and see if that helps fix the bug. I followed the instructions Oracle gives for updating to Java 7 (which is pretty much to just download and install and all should be good to go). I downloaded Java 7, installed it and visited the panel via System Preferences. Yet, when I open a terminal and type "java -version" I get 1.6. I used command "which java" (just guessing from my use of Linux) and got /usr/bin/java. How do I actually update the Mac's settings to point to the latest Java 7 I installed? I am using OS X 10.8.2.

Thanks for your help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64848
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't directly help you because all my clients have no plans to update to Java 7 in the near future, so neither have I.

But I assume you have seen this FAQ? I'm posting it just in case you haven't (or someone else hasn't).
 
Alvin Watkins
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Bear.

Yes. I followed those directions. They are the ones that say all you have to do is download and install and you'll be good to go. In my case, it did not change the JRE. It just added Java to the System Preferences app. When I open a terminal and type java -version it still says 1.6.

 
Ivan Jozsef Balazs
Rancher
Posts: 979
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I used command "which java" (just guessing from my use of Linux) and got /usr/bin/java

The Linux analogy would further suggest to use
file /usr/bin/java
to see whether it is a real file or a (sym or hard) link. In the latter case you could tweak it to point to the new java.
Provided it is available and you were able to locate it.

find / -name java


 
Alvin Watkins
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ivan.
 
Ivan Jozsef Balazs
Rancher
Posts: 979
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write version-dependent wrappers for the JDK commands like java15 or javac16 or javap17 etc. and put them to a directory on the PATH.
These wrapping scripts call the corresponding executables using the absolute path names forwarding all arguments.
So a peaceful coexistence of several different Java versions is achieved.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic