changing java version

Discussion in 'Mac Programming' started by sms, May 8, 2005.

  1. sms
    macrumors newbie

    May 8, 2005
    I just updated to 5.0 and changed the java version from the java preferences as instructed in the installation instructions. However, from the terminal if I type java -version it shows that the 1.4 is still the default. Can someone tell me how to set 5.0 as the default from the terminal.
  2. macrumors 6502a

    Apr 19, 2005
    You will also have to restart i believe to make the changes effective for that shell.. double check your directions and try it again, you probably just misread and didn't do something right.

    as a side note, anyone who is updating may want to be warned that it does break some applications that ran fine with 1.4... so be careful and if you find an app doesn't work anymore, that would be why.
  3. sms
    thread starter macrumors newbie

    May 8, 2005
    I restarted, restarted the machine, kicked it a couple times and still no go. Any idea what the command is to change the java version from the command line, been looking everywhere and I can't seem to find it.
  4. macrumors newbie

    Nov 16, 2005
    Changing Java Version in MAC

    Hi Mate,

    I have done it very manually. Actually, as you install higher version of java, the current jdk directory points to it. At the same time the older versions are not deleted and an archive are maintained. In case of JDK 1.5 this does not happen. The information about the java is stored in Infor.plist under the resource directory.
    In order to change java to any new or restore to previous version this following step works
    Go to : /System/Library/Frameworks/JavaVM.framework/Versions
    Copy all the files and directories from the particular version directory which you want to change to and paste them to the folder CurrentJDK.
    e.g. to change to 1.5 I will copy all the folders from /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/ to /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/

    To perform any action on system folders you need to have system root login.
    Please be careful in changing any system files with this login as the login has full right to curropt the OS too.
  5. Guest


    Feb 17, 2003
    Hitchin, Herts, UK
    Can't you just symlink them rather than copying?
  6. Moderator


    Staff Member

    Dec 7, 2002
    Whakatane, New Zealand
    Just use the Java Preferences app. It's a bit tricky to find, so the easiest way is to use Spotlight.

    If you want to open it manually, it's in /Applications/Utilities/Java/J2SE 5.0/Java Preferences.

    Edit: It seems that this doesn't change everything, as "java -version" is still reporting 1.4.2 for me.
  7. macrumors 65816


    Apr 19, 2004
  8. macrumors newbie

    Nov 16, 2005
    Creating symlink or alias did not helped, only copying did. CurrentJDK direcotry is actually an alias of 1.4.2 directory. Now, where this information is stored, I was unable to find out, so the only thing for time being we can do is use 1.4.2 or CureentJDK directory act as 1.5 that can only be done by copying all the installed file of 1.5 to the CurrentJDK folder or virtually in 1.4.2 folder. Thus, prior to this preserve the content of 1.4.2 in some other folder, this will help u to revert to 1.4.2(or previous version) any time.

Share This Page