How to force reinstall Java on Mac OS X

If you’ve managed to screw up your existing Java installation on Mac OS X, or you’re looking to downgrade for reason(s) best know to you, here’s a nice and easy way of preventing Mac OS X from telling you it knows best ((The “installer cannot run on this machine because it does not have…” messages)).

Note: This method does not require Pacifist and/ or modification of the installation package in any other way.

Disclaimer: This works on Mac OS X 10.3.9. It may or may not work on Tiger. It may or may not blow up your computer. You run it at your own risk.

And finally, the method:
Step 1 (aka Duh!)
Download the version you need to install on your machine from Apple’s site.

Step 2 (aka My Lucky Day)
Run it and see if it lets you do the needful. If this step is successful, you shouldn’t have been reading this page in the first place. Thanks for wasting my bandwidth. If not, exit the installer and proceed.

Step 3 (aka The Good Stuff)
In Finder, go to folder /System/Library/Frameworks/JavaVM.framework/Resources and move the files “version.plist” and “Info-macos.plist” to a safe place like the Desktop. The moving process might prompt you for password and involve two separate transactions – copying files to the target location and then deleting them from the source.
Hope I have been successful in complicating a simple process.

Step 4 (aka Eureka)
Run the installer again and watch as it proceeds with installation. You didn’t think it would work, did you?

Step 5 (aka Double Check)
Open Terminal and type “java -version”. Is it what you just installed?

Step 6 (aka Optional)
If you answered yes to #5, it’s safe to delete the files you kept as backup. You may, however, want to keep them for reasons best known to you. Leave a comment, below, reassuring everyone that this method actually works.
If you answered no or if step 4 didn’t work for you and you are running Panther, leave a comment so I can take down this post/ blog. If you are running Tiger, please drop in a line to let all the regular readers of this blog (half a dozen Windows users) know that this technique won’t run on 10.4.

Note on disclaimer: In case you are wondering, I was kidding about the blowing up bit. This technique builds on the method described in an official Apple Technical Note. While the note says that removing one file would do just fine, my experiments showed you needed to remove both, especially if you are changing versions. Also, like I said above, you can install any version of Java intended for your OS, not just the one that came with your CD/ DVD like the note says.

Symptoms (aka when to use this method)
This method is known to fix the “Segmentation Fault” and “HotSpot not at correct virtual address. Sharing disabled.” states that some Java installations may find themselves in.

38 Comments

  1. That installer is poorly written. It should ask you if you want to move forward anyway. Your post was extremely helpful. For that I thank you.

  2. If this works, thank. For nonhacker with deep belief to own…bla…
    It worked! Now my Mac has found it reason for updating.

    Thanks

    KK

  3. Your steps worked for me as I was trying to install java from here: http://meiert.com/en/blog/20071029/java-and-lynx-for-mac/

    I mean the installation finished gracefully, but when I type java -version, I still see the old version only. Has anyone had to switch to the new version manually?

    I see the newly installed java 1.6 in /System/Library/Frameworks…. but I don’t see it in my Eclipse Run configuration JRE list. So I’m still stuck.

  4. I tried on 10.4 to roll back to Rel6 from Rel 7 because java web start apps were just sitting at “Application starting” after the autoupgrade to Rel 7. It will get past that and actually try to start the app, but now I get an unexpected error, exception, java.lang.reflect.InvocationTargetException error

  5. Thank you, it ran for me under Leopard (10.5.5) for java 10.5 update 2.

    It solved the strange behavior of Java on my system : any java application that I compiled performed well but eclipse and blueJ crashed. Only Netbeans was not affected.

    Thanks again.

  6. Worked like a charm with 10.4.11 and the excellent Pacifist freeware. I was looking at a reinstall for a machine with OSX server and and so was not looking forward to the hours of down time and waves of moaning. Thank you!

  7. Worked excellently for 10.4.11 to replace the last Java update. Had to downgrade to 1.5 to run some Java apps fully. Thanks for posting this!

  8. I had a sound problem with Java, and I did what you said and now I don;t have java on my Mac AT ALL! It’s gone, no matter how many times I re-install it… I don’t know what to do!

  9. Thanks mate, delete java 1.6 and the installer did not extract Java 1.6. Spent 3 hours before doing what you mentioned – and voila successful!!

    Thank you very much.

  10. Thanks so much!! I was really afraid I was gonna have to reinstall the os XD

    I was wondering if you could maybe help me on something else too. The reason I got into this mess in the first place is I can’t seem to run Java Applets on this account; it worked fine when I created a guest account, but I’d really prefer if it worked on this one… I’ve been using this page: http://www.javatester.org/version.html and all I see is a coffee cup and two arrows…

    Any help is welcome! Thanks

  11. This method worked perfectly for my mac. I am running OS X10.4.11 and JAVA 6 installed just fine. I just needed to go back to Applications/Utilities/Java/ Java SE6 and make Version 6 the default and drag it to the top of the java versions list. Success is sweet especially since this means I don’t need to upgrade to Leopard which is having problems of its own.

  12. Thank you very much Kunal for your generous Java fix. Today, there was an intel update and safari update on my macbook. Since then, safari has been crashing like mad. I should’ve never authd the update. Still trying to work on a fix for that. Please email me if you know of one. Anyways, I deleted java files in the process. Thanks for the fix once again!

    1. You can definitely give it a shot and as long as you backup the files mentioned in Step 3, you have nothing to lose. At worst, it won’t work – can’t mess with your system.

      Do let us know how it goes!

  13. I’ve tried the whole process and it happened as you described, but…
    When i open java preferences, i manage to set version 1.6.0 on top of java application runtime settings, but above on the same window i only have option for J2SE 1.4.2 and 1.5 – shouldn’t there be 1.6 there as well?
    I still don’t have this right

    Help, please…
    Thank you so much so far!

      1. This is what i get:
        java version “1.6.0-dp”
        Java(TM) SE Runtime Environment (build 1.6.0-dp-b88-34)
        Java HotSpot(TM) Client VM (build 1.6.0-b88-17-release, mixed mode, sharing)

        What i described before is what i see in the preferences window of java.

          1. I’ve visited the URL you recommended. I think i’m not getting the applet i should on that page. On the top of the page says:
            This article applies to:

            * Platform(s): Solaris SPARC, Solaris x86, Red Hat Linux, SUSE Linux, Windows 7, Vista, Windows XP, Windows 2000, Windows 2003, Windows 2008 Server, Windows ME, Windows 98, JDS
            * Browser(s): Internet Explorer, Firefox, Mozilla, Netscape
            * Java version(s): 1.4.2_xx, 1.5.0, 6.0

            Then there is a large blank space followed by

            Get Java Installation Help Now
            Printable VersionPrintable Version
            How do I test whether Java is working on my computer?
            This article applies to:

            * Platform(s): Solaris SPARC, Solaris x86, Red Hat Linux, SUSE Linux, Windows 7, Vista, Windows XP, Windows 2000, Windows 2003, Windows 2008 Server, Windows ME, Windows 98, JDS
            * Browser(s): Internet Explorer, Firefox, Mozilla, Netscape
            * Java version(s): 1.4.2_xx, 1.5.0, 6.0

            If your applet is not displaying properly, please check these additional configurations.

            1. Enable Java through your Web browser
            2. Enable Java through the “Java Plug-in Control Panel”
            3. Clearing your Web Browser Cache

            If you are unable to perform any of the steps above due to an error, please reinstall Java. Download and installation instructions

            I’ve cleared my cache and all, but don’t understand how to test java on my mac.

            My question is: when i open the java preferences window, shouldn’t i see J2SE 1.6.0 as an option?
            I have only 2 options: J2SE 1.4.2 and J2SE 5.0 – i’ve selectec 5.0

            But on the little case further down the window i have also 1.6.0 – which i can drag to the top of the list.
            Should i delete any temporary files. I really don’t want to mess this up.

  14. Works on Mac OS X 10.4.11 (Intel Core 2 Duo).

    After installation, you must go to Applications > Utilities > Java > Java SE 6 > Java Preferences. In the top drop-down box select Use Version: “Java SE 6”. Then in the middle of the same page, under “Java Application Runtime Settings” drag “Java SE 6” to the top of the list. Click save in the bottom right corner. To test, open terminal and type java -version. Should now show:

    java version “1.6.0-dp”
    Java(TM) SE Runtime Environment (build 1.6.0-dp-b88-34)
    Java HotSpot(TM) Client VM (build 1.6.0-b88-17-release, mixed mode, sharing)

    NetBeans sure looks pretty compared to soylatte “hack” =)

  15. This worked perfectly!! I am shocked and very happy. I was worried because I promised my friend I would give him my eMac, and he’s a fanatic of Runescape, and I was tormenting myself because he was so excited about having his own computer to play Runescape on, and I spent hours trying to figure out how to run freakin’ Java 1.6 on my eMac running OSX 10.4 (Tiger), and I was almost sure it was not possible. But hey I didn’t give up!! And I found this awesome person Kunal with the right solution.

    All I had to do was go to Finder > Applications > Utilities > Java > Java SE6 > Java Preferences > then choose “Java SE 6” on the “Use version tab”. Then save.

    Then I had to reopen it, go to Java Preferences again (same process as before), but this time on the “Java Application Runtime Settings” move the “Java SE 6” to the top of the column.

    And now Java 1.6 is running on my eMac running Tiger OSX 10.4

    🙂

    Thank you!!

  16. Hi Kunai,
    I don’t have any folder in Library called ‘Frameworks’. Could there be another path to the Java settings?

  17. I made it!
    I didn’t realize that I had to go to GO, and then scroll down to ‘Go to Folder’ – and from there go to System etc.
    I had to go into JAVA 6 and change the default.
    And then I had to restart the machine. After restarting it read the new Java version.

    Thanks a lot!!!
    I have a PowerBook G4, Tiger, Mac 10.4.11

  18. I downloaded java 6 but when i want to install into my mac running 10.4.11 it says “the following disk image fail to mount”. so i don’t get what is the problem…
    any help is appreciated.

  19. I should be doing someting wrong. I received an error messanje: “Java-6dp.dmg no mountable file systems”
    My OS is 10.4.11.

    Here is my log

    Kokaleka:~ GR$ java -version
    java version “1.5.0_19”
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-306)
    Java HotSpot(TM) Client VM (build 1.5.0_19-138, mixed mode, sharing)
    Kokaleka:~ GR$
    Thx

  20. Hello.

    Thank you so very much for your notes. I had spent some time searching for just this information. Greatly appreciated 🙂

Leave a Reply to John Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.