jdk 6 on mountain lion

50,983

Solution 1

As I recall, the first time you do something that needs Java the OS will ask if you want to install it, and version 6 is what you get. According to this page, typing java -version in the Terminal is enough to trigger the prompt.

For the JDK (and not the runtime), you'll need to log into developer.apple.com, search for java, and download the Java for OS X 2012-006 Developer Package. I just did this on my MacBook and now have javac 1.6.0_37.

Solution 2

  • browse to to https://developer.apple.com/downloads/
  • Download Java for OS X 2013-005 Developer Package
  • Double-click the resulting java_for_os_x_2013005_dp_11m4609.dmg to open
  • Double-click JavaDeveloper.pkg to install; go with the defaults/agree to license/enter your password
  • Bring up terminal and type java -version to make sure you have the right version.
  • if it's the wrong version, (e.g. java version "1.7.0_45"), then you need to modify ~/.bash_profile:

    # Java 6 for Android Development
    export JAVA_HOME="/Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home/"
    
  • Log out & log in again & make sure you're running the correct version: java -version. Should be java version "1.6.0_65".

Solution 3

For some bizarre reason - before Java7 it was actually apple that supplied/supported java for OSX instead of Sun/Oracle. That situation only recently changed with JAVA7. So, to get an earlier version - like Java6, go to either http://connect.apple.com - sign in with your apple Id and you will find the jdk for 1.6 listed. You can also find it via https://developer.apple.com/ - or as I already said, starting with 7, you can get it directly from http://www.oracle.com/technetwork/java/index.html

Solution 4

Unfortunately I didn't see this answer until after I already found a rather wonky solution...I'm assuming that downloading the Java installer from developer.apple.com is the easiest way of installing Java 6, but if, like me, you had installed Java 7, and you're trying to downgrade and it's not working (i.e. if installing the developer download still leaves you with Java 7 as the default version), you can download the Java package for OS 10.6 then open it using Pacifist, then copy the files over. (Copying the files from the package for 10.7 did NOT work for me - apparently it installs Java 7, or at least it leaves Java 7 as the default version with no way to choose version 6 instead).

More info here: https://stackoverflow.com/a/6413600/560114

Share:
50,983
Black
Author by

Black

Updated on January 19, 2020

Comments