X

Reinstalling Java in OS X 10.5

<p>The other day we wrote an <a href="http://www.macfixit.com/article.php?story=20090707133654280">article</a> about Java incompatibilities causing problems with Apple's Mail program, and linked to an Apple knowledgebase article that claimed the simple wa

CNET staff
3 min read

The other day we wrote an article about Java incompatibilities causing problems with Apple's Mail program, and linked to an Apple knowledgebase article that claimed the simple way to reinstall Java is to delete the internet plug-in bundle and run the Java updater again.

This information from Apple is incorrect. In Leopard, the Java plug-in is an alias to a core system location for Java resources instead of being a standalone plug-in, as we briefly described in a follow-up article. This has made people hesitant to delete the files and do a reinstall because they suspect it will do more harm than good.

While reinstalling Java to clear problems is not as straightforward as Apple claims, it can be done; however, it does take an in-depth approach with the Terminal. However, if you are having problems with Java, first try reinstalling the latest updates for both it and the operating system before trying to remove and reinstall Java.

Reapplying the latest updates:

First download and apply the latest "combo" system updater for Leopard, and reapply it when booted into Safe mode:

In addition, try reapplying the latest Java update in a similar manner:

Reinstalling Java:

Lastly, besides running an Archive and Install of your operating system, which should clear any Java problems because of corrupt files, you can try reinstalling Java by following this procedure outlined here at MacOSXHints.com (Be sure to back up your files beforehand):

  1. Download the following files to your desktop:

    OS X 10.5.7 Combo Updater
    Java for OS X 10.5, Update 1
    Java for OS X 10.5, Update 2
    Java for OS X 10.5, Update 3
    Java for OS X 10.5, Update 4

    In addition to these files, be sure you have your Leopard installation DVD handy.

  2. Delete the following files and folders (You may need to authenticate to do this):

    /Library/Java
    /Library/Internet Plugins/JavaPluginCocoa.bundle
    /System/Library/Java
    /System/Library/Frameworks/Java/ (all files in here, keeping the parent folder)
    /Users/username/Library/Caches/Java

  3. Run the following command in Terminal and locate the Java-related packages in the resulting list:

    sudo pkgutil --packages
  4. Run the following command to "forget" the java packages in the previous list (will need to be run several times).

    sudo pkgutil --forget NAME

    In this command, "NAME" is the full name of the Java-related files in the list (ie: "com.apple.pkg.JavaSE6", "com.apple.pkg.JavaToolsLeo", "com.apple.pkg.JavaUpdateForMacOS10.5Update2", etc.)

  5. Insert your Leopard installation DVD and run the following two commands to install the original version of Java that came with Leopard (You may need to change the file paths if the names are different for either the install disk or the destination drive):

    installer -verbose -pkg "/Volumes/Mac OS X Install Disk/System/Installation/Packages/Java.pkg" -target "/Volumes/Macintosh HD"
    installer -verbose -pkg "/Volumes/Mac OS X Install Disk/System/Installation/Packages/JavaTools.pkg" -target "/Volumes/Macintosh HD"

  6. When the install is done, run the previously downloaded combo updater, followed by each Java update sequentially, rebooting as required. After this is complete, Java should be fully reinstalled and updated.
  7. UPDATE: Corrected missing quotes in the "installer" commands

    Resources

  8. article
  9. follow-up article
  10. http://www.apple.com/downl...
  11. http://www.apple.com/downl...
  12. here
  13. OS X 10.5.7 Combo Updater
  14. Java for OS X 10.5, Update...
  15. Java for OS X 10.5, Update...
  16. Java for OS X 10.5, Update...
  17. Java for OS X 10.5, Update...
  18. More from Late-Breakers