Here is how one goes about upgrading to 10.4 in more detail.
http://support.apple.com/kb/DL847 offers the most current Java for 10.4, and thus the most current Java you can run concurrently with Mac OS 9's Classic running in the background. If you need a more current Java, see this tip on 10.5 & 10.6 Java versions, and this tip about upgrading to 10.5. Note if your Apple menu -> About This Mac says you have an Intel processor, you can upgrade to 10.6.8 for less than 10.5 through 10.5.8. PowerPC (G4 and G5) users wishing to update to 10.5.8 must have at least an 867 Mhz processor (1 Ghz is higher), and be willing to lose Classic on the 10.5 boot to use Java in its latest form for PowerPC. Those with less than 867 single processor, update to 10.4.11 PowerPC after backing up and shutting down their Mac and disconnecting the backup to be able to install the 10.4 update for Java. Those who have no Firewire port as shown here:
can't update to 10.4, and need to read this tip on Java and 10.3 and earlier:
Either way, you won't be able to get the most secure Java version, unless you have a Mac OS X 10.7.3 compatible machine, which the tip on 10.5 & 10.6 Java versions discuss.
On a separate similar issue, this thread discusses running Adobe Flash on older browsers: