0

I'm new on mac and I need to install both Java 6 and Java 7. My Mac's version is Mac OS X Lion 10.7.5 (11G63)

The problem is I have found already installed Java 7 and I need to install Java 6 and switch between them because I have some projects needed 6 and others need 7. I normally go on oracle web site and download the version's Java that I need to install on Linux or Windows.

The problem is that I couldn't find the version for Mac on http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR

Could someone explain me how I can get Java 6 and how I can switch between them? Thanks a million

2
  • 1. welcome to SO. This doesn't seem to be related to programming. You might be better off at Ask Different. 2. I'm not into java at all but I guess it is backwards compatible. So you only need the most recent Java version available. Commented Mar 26, 2014 at 17:19
  • Thanks HAS, I'm a developer and I need both version of Java how I explained before. The problem is not if they are compatible I want just install Java 6 and switch between java 7 Commented Mar 26, 2014 at 17:26

1 Answer 1

1

Welcome to Mac world !! You need to download Java from this site and install it on your system. After that, open your terminal and type

javac -version 

You will see that it still shows your java version 1.7.

What you need to do next is using java_home to check the path of the java 1.6

$ /usr/libexec/java_home -v 1.6 /Library/Java/JavaVirtualMachines/1.6.0_45-b06-451.jdk/Contents/Home $ /usr/libexec/java_home -v 1.7 /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home 

So, whenever you need 1.6 or 1.7, you can set the path of the particular version in /User/<your-account>/.bash_profile. For example:

export JAVA_HOME="/Library/Java/JavaVirtualMachines/1.6.0_45-b06-451.jdk/Contents/Home" # export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home" 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks bubuzz, it works great, I can't give you a reputation because I didn't have yet 15.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.