Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Reinstall Java on Leopard System 10.5
I was asked to figure out how to reinstall Java on a Mac without reinstalling the OS. Apparantly the user was complaining that Java would not work in Safari and, while trying to fix the problem, the Help Desk deleted enough required files that Java was completely trashed. Here's what I did to completely reinstall it:

Download (from Apple's Support Downloads page) but do not install the latest Combo Update for OS X, as well as all of the JavaForMacOSX10.5s you see there. (I used Updates 1, 2, adn 3, even though 1 was not a prerequisite for 2). Save these files in an accessible place -- you'll use them later.

Next, make sure you have the latest-available shrink wrap version of OS X (it was 10.5.6 when I did this). Now, after this next step, you will be beyond the point of no return...

Delete /Library/Java, /Library/Internet Plug-ins/JavaPluginCocoa.bundle, /System/Library/Java, /System/Library/Frameworks/Java/* and your user's Library/Caches/Java folder (not sure whether this mattered). You may have to use Terminal and sudo to delete the folders in /Library and /System.

Open Terminal and run sudo pkgutil --packages. With the results from the above command, use the pkgutil --forget command to "forget" about all of the Java packages in the list. I used forget the following com.apple.pkg packages: Java, JavaSE6, JavaToolsLeo, JavaUpdateForMacOS10.5Update2, and JavaUpdateForMacOS10.5Update3. So each command looked like this: sudo pkgutil --forget com.apple.pkg.Java.

Next, insert the Leopard disk and run the following in Terminal to reinstall Java:
$ 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"
Change the paths in each command as necessary for both the OS X Install disc and your system hard drive. Finally, reapply the latest Combo Update that you previously downloaded, then reboot (as the update will require). After the reboot, apply all software updates (or just the ones you pre-downloaded earlier -- your choice). Java should be fine now, you can test it by trying www.javatester.org in your browser.

[robg adds: There's an earlier hint here that discusses a simpler fix, but one that probably won't work for this problem (deleted files). If there are easier ways to reinstall Java from scratch, please post in the comments.]
    •    
  • Currently 2.82 / 5
  You rated: 4 / 5 (11 votes cast)
 
[48,550 views]  

10.5: Reinstall Java on Leopard | 19 comments | Create New Account
Click here to return to the '10.5: Reinstall Java on Leopard' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Reinstall Java on Leopard
Authored by: blackxacto on May 18, '09 08:08:43AM

G5/dual/2.0ghz/3gigRAM/OSX5.7/Safari beta

Did updating to 5.7 break Java compatibility of Safari Beta? I can no longer access Yahoo Mail interface. I have to use Firefox to access Yahoo Mail. I first used update software from the Apple menu, rebooted, deleted Safari application, then installed Safari beta. No joy w Yahoo Mail afterwards. Reset Safari and shut off plug-ins to Safari Beta. Is Java the key?

jr

---
You'll never know which way to look, which way to see us.



[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: MacTripper on May 18, '09 08:25:38AM

Look, I know it tests one's geeky skills to be able to reinstall Java on OS X. That's cool and all if your into that, most can't do that.

Apple has gifted us with "Time Machine" although a great concept, it makes it easy for one to automatically backup their data, it does nothing to solve a problem like the one in the article.

Rather the easiest way to reinstall Java on OS X (and anything else that might arise for that matter, like a hard drive crash) is simply to clone one's boot drive at regular intervals. (carbon copy cloner or super duper, no compensation for mention)

Now Apple has totally shunned this method in their "Time Machine" concept, it could have been added as a "Advanced Feature" hidden in some sub-menu someplace to avoid confusion (or only appears when option booting for instance), but would have saved the day in this instance.

"Time Machine" applied to OS X itself, with option boot abilities, would have allowed the "Java" problem to be easily remedied. Just option boot to the "Time Machine" drive and go back to a previous OS X install, then Software update from there.

Data is preserved, OS X is restored to a previous state.

Heck, even Microsoft has some sort of OS restore method, although that really doesn't help being on the same drive and with all the malware they experience.

Apple needs to apply the "Time Machine" concept to the OS, to protect against software failure, exploitation and hard drive failure.





[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: SuperCrisp on May 18, '09 08:41:20AM

Of course you're right. In a perfect world this would be the case. But since most users don't even back up, I doubt an improvement to Time Machine would help.



[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: MacTripper on May 18, '09 09:16:44AM

<i>Of course you're right. In a perfect world this would be the case. But since most users don't even back up, I doubt an improvement to Time Machine would help.</i>

People don't backup because sellers don't inform people of the possibility of failure with their new machines.

If you try to inform them, customers think your trying to pitch them to buy something more than they already have or worse think there is something wrong with the machine they are about to buy.

Apple should package a 'user friendly' option bootable Time Machine (with OS X previous version ability) drive with all new machines. Especially consumer models.

It would only add about $80 to the price. Naturally a opt out for those who already have a backup solution.

But this way every computer newbie will have a automated backup solution and get into the backup habit, not learning after a failure occurs.

A top down solution instead of a bottom up one.




[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: asmeurer on May 18, '09 01:08:44PM

If you ever buy a Mac from an Apple store, the salespeople will always suggest that you buy a hard drive from them. All the user has to do is plug the drive in to make Time Machine work. Making it bootable would be a nice feature for a future OS release (Snow Leopard?). I think that the Apple online store also has external hard drives listed as one of the 'accessories" that it suggests that you buy after you are done purchasing a new Mac. On the other hand, you have a point. Companies either have to admit that their product will likely fail or convince consumers that they will likely accidentally do something they didn't want to do, such as deleting a file, to convince them that they need to backup. But that really should only be difficult for someone who has never used computers before.



[ Reply to This | # ]
Reinstalling from a Time Machine backup
Authored by: gidds on May 18, '09 01:30:18PM
I know it'd be cool if Time Machine backups were bootable.  But you can still use them even if your disk is completely hosed.  Just boot off the Mac OS X CD, and use that to restore the whole drive from any of the backups.  Presto!

It may take a while, so having a separate, bootable clone may be a giid idea too. But it does work; even to a new, freshly-formatted drive.  More details on various sites, such as this blog entry.

---
Andy/

[ Reply to This | # ]

10.5: Reinstall Java on Leopard
Authored by: Dr. T on May 18, '09 09:51:10AM

The workaround for reinstalling only Java is complex, and the process appears to be time consuming. A mistake could further damage the OS. This process does not seem easier than reinstalling OS X (archive and install) and using Migration Assistant to restore the system to its original state. Sometimes the geekiest solution is not the best solution.



[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: fmaxwell on May 18, '09 10:24:28AM

Your comment assumes that the Migration Assistant will work flawlessly. It does not. I can't recall everything that it missed last time I used it, but it was not inconsequential.

It's pretty darned good, but if you spent considerable time configuring your OS and/or doing "tricky stuff", you may find yourself having to spend a lot more time to restore things to where they were.

Also, the tip seems pretty straightforward to me. Not really complex at all.



[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: mmassa on May 18, '09 01:00:20PM
You could also try Pacifist: http://www.charlessoft.com/

This may make it easier for those that prefer to use an easy to understand GUI. You'll still need your install disk, but at least you won't have to worry about mis-typing something.

[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: itistoday on May 18, '09 04:00:00PM

A lot of people complaining that this is "too hard" of a hint... wtf? Terminal commands got you scared? Maybe you should install some parental controls to protect you from them.

I for one think this is a great hint, bookmarked! And thanks to the submitter!



[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: cm0901 on May 23, '09 01:52:12AM

I was having some problem with Zend Studio, a PHP IDE that runs under Eclipse, another IDE that runs in Java. I decided to follow this hint to "fix" my Java, and hopefully fix that Zend problem. But now my Java is completely broken: I can't run ANY Java-based app, not even Cyberduck which, it seems, has some parts written in Java. Can anyone help me?



[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: palahala on May 23, '09 02:40:18AM

These comments are not really suitable as a support forum, I think, and you're not really giving any details about what you did either.

What went well and what went wrong? Did all steps complete successfully? By typing "history" in Terminal, can you verify you indeed executed all steps described in this hint, in the correct order? You may want to keep that history for future reference by typing "history > ~/Desktop/java-problems.txt" Does "which java" in Terminal give you any results? Does "java -version" show anything? Does the folder /Library/Java have any content?



[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: cm0901 on May 23, '09 04:11:26AM

Everything was fine during the process, i had no error whatsoever. java -version says

java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)

so, it seems that everything is fine. But running, let's say, Cyberduck, I get:

23/05/09 13:06:37 /Applications/Cyberduck.app/Contents/MacOS/Cyberduck[758] Java requesting shared archive generation, version 1.5
23/05/09 13:06:38 /Applications/Cyberduck.app/Contents/MacOS/Cyberduck[758] Java is sending command '1.5' to updateSharingD
23/05/09 13:06:42 [0x0-0x36036].ch.sudo.cyberduck[758] -[NSJavaVirtualMachine initWithClassPath:] FATAL: cannot initialize ObjCJava. Exit
23/05/09 13:06:42 com.apple.launchd[421] ([0x0-0x36036].ch.sudo.cyberduck[758]) Exited with exit code: 255



[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: cm0901 on May 23, '09 04:08:08AM

Everything was fine during the process, i had no error whatsoever. java -version says

java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)

so, it seems that everything is fine. But running, let's say, Cyberduck, I get:

23/05/09 13:06:37 /Applications/Cyberduck.app/Contents/MacOS/Cyberduck[758] Java requesting shared archive generation, version 1.5
23/05/09 13:06:38 /Applications/Cyberduck.app/Contents/MacOS/Cyberduck[758] Java is sending command '1.5' to updateSharingD
23/05/09 13:06:42 [0x0-0x36036].ch.sudo.cyberduck[758] -[NSJavaVirtualMachine initWithClassPath:] FATAL: cannot initialize ObjCJava. Exit
23/05/09 13:06:42 com.apple.launchd[421] ([0x0-0x36036].ch.sudo.cyberduck[758]) Exited with exit code: 255



[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: gunmetal on Sep 16, '09 09:52:02AM
The installer command didn't work for me, it errored out on the use of -target. I changed it to the following and it worked.

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

I also rolled this into a simple shellscript as I have to do this to several Macs that got automatically patched before I realized a Java patch came out (which broke an application we use). I can post it later, after I test it.

[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: gunmetal on Sep 22, '09 09:30:49AM
Here is the shell script I used. I copied the Java packages from the OS X Install DVD (located inside /System/Installation/Packages), so I could roll this out to alot of Macs via SSH, from a common network volume. Change the JavaFix directory in the installer commands to point to your directory where these packages are stored. Here are the locations for Update 2 and 3, which I downloaded to the same directory. JavaforMacOSX10.5Update2 JavaforMacOSX10.5Update3
#!/bin/sh
# File Name: RevertJavaforLeopard.command
#
# Removing files and folders for Java installed on Mac OS 10.5.
rm -rf "/Library/Java" "/Library/Internet Plugins/JavaPluginCocoa.bundle" "/System/Library/Java" "/System/Library/Frameworks/JavaVM.framework/" "~/Library/Caches/Java"
# Using pkgutil to forget old Java related packages.
pkgutil --forget  com.apple.pkg.JavaToolsLeo
pkgutil --forget  com.apple.pkg.Java
pkgutil --forget  com.apple.pkg.JavaForMacOSX10.5Update2
pkgutil --forget  com.apple.pkg.JavaForMacOSX10.5Update3
pkgutil --forget  com.apple.pkg.JavaForMacOSX10.5Update4
pkgutil --forget  com.apple.pkg.JavaForMacOSX10.5Update5
# Installing the Java packages from 10.5.4, as well as Java Updates 2 and 3. I extracted the Java packages from the DVD so I could roll out this fix via SSH off a network volume.
installer -target / -verbose -pkg "/JavaFix/Java.pkg"
installer -target / -verbose -pkg "/JavaFix/JavaTools.pkg"
installer -target / -verbose -pkg "/JavaFix/JavaForMacOSX10.5Update2.pkg"
installer -target / -verbose -pkg "/JavaFix/JavaForMacOSX10.5Update3.pkg"
# You could include JavaForMacOSX10.5Update4 possibly, but I've found performance of Java Web Start launching better with only Update3 applied.


[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: fr3dly on Sep 23, '09 11:29:10AM
i've got a question.

i'm in the 'Frameworks' dir and there is *no* 'Java' folder within the 'Frameworks' dir. but, there are four .framework files that are Java related. screencap of the files -> http://screencast.com/t/FGZRSxqjr5

my question - should i delete these files, then move on with the instructions?

thanks.

[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: brahn on Apr 20, '10 05:56:01PM
I just went through the process (successfully, as far as I can tell) and found that you should *not* delete the Java-related frameworks. I moved them out of the way, and the next step (sudo pkgutil --packages) failed, so I put them back.

[ Reply to This | # ]
10.5: Reinstall Java on Leopard
Authored by: ankh on Aug 12, '10 09:42:13PM

> make sure you have the latest-available shrink wrap version of OS X

What does this mean exactly? Buy a copy of OSX in shrinkwrap from the Apple store?
Because I bought 10.6 when it first came available, but it's been updated many times since.
I have no idea what Apple is currently selling shrinkwrapped.



[ Reply to This | # ]