It's not a secret anymore!
The moose likes Mac OS and the fly likes Setting JAVA_HOME in Mac OS X Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "Setting JAVA_HOME in Mac OS X" Watch "Setting JAVA_HOME in Mac OS X" New topic
Author

Setting JAVA_HOME in Mac OS X

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9967
    
    3

I have exported the following line to my .bash_profile:

export JAVA_HOME=$(/usr/libexec/java_home)


When I run:



I see the following:


Doing a java -version returns the following:



How can I force JAVA_HOME to point to JDK 7?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9967
    
    3

One step closer to what I want:



I now have multiple JDK 7. How do I force it to use 1.7_x in my case?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9967
    
    3

Got this fixed!



did the trick!
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32614
    
215

I gave you a cow for fixing the problem "in the middle of the night" by yourself and sharing the solution.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9967
    
    3

Jeanne Boyarsky wrote:I gave you a cow for fixing the problem "in the middle of the night" by yourself and sharing the solution.


I will milk that cow now! Thanks!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9967
    
    3

Bumping on my very own thread. I just installed Java 8 on my Mac and tried to export the path in my .bash_profile. But now I'm not able to find out which version is installed as I see the following on starting up a terminal:

Unable to find any JVMs matching version "1.8.0_60".


I installed jre-8u60-macosx-x64.dmg on my Mac. What would this be as a version number that I can export as JAVA_HOME?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9967
    
    3

Ok I got this fixed! I had to download the JDK and not just the JRE:

http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9967
    
    3

Another cow perhaps?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting JAVA_HOME in Mac OS X
 
jQuery in Action, 3rd edition