Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,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 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[11,425 views]  

10.5: Reinstall Java on Leopard | 17 comments | Create New Account
Click here to return to the '10.5: Reinstall Java on Leopard' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
10.5: Reinstall Java on Leopard
Authored by: blackxacto on Mon, May 18 2009 at 8:08AM PDT
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 Mon, May 18 2009 at 8:25AM PDT
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 Mon, May 18 2009 at 8:41AM PDT
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 Mon, May 18 2009 at 9:16AM PDT
<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 Mon, May 18 2009 at 1:08PM PDT
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 Mon, May 18 2009 at 1:30PM PDT
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 Mon, May 18 2009 at 9:51AM PDT
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 Mon, May 18 2009 at 10:24AM PDT
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 Mon, May 18 2009 at 1:00PM PDT
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 Mon, May 18 2009 at 4:00PM PDT
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 Sat, May 23 2009 at 1:52AM PDT
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 Sat, May 23 2009 at 2:40AM PDT
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 Sat, May 23 2009 at 4:11AM PDT
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 Sat, May 23 2009 at 4:08AM PDT
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 Wed, Sep 16 2009 at 9:52AM PDT
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 Tue, Sep 22 2009 at 9:30AM PDT
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 Wed, Sep 23 2009 at 11:29AM PDT
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 | # ]