http://support.apple.com/kb/DL1359 is the newest Java that Mac OS X 10.5 will support on either Intel or PowerPC Macs. People with 10.5 through 10.5.7 must backup their data, and shut down, disconnect their backup, and then update to 10.5.8 before they can use the Java.
Note, if you need Java 1.6, according to the download link above, it is only available for 64 bit Intel Macs, and not PowerPC Macs. Otherwise
you are stuck with Java 1.5.
If you have an Intel Core2Duo, i3, i5, i7 or Xeon Mac, you can upgrade to Mac OS X 10.7.3 to get Java 7, which is far more secure.
Please read the link on upgrading, as there are pitfalls for taking this path are important to read.
Mac OS X 10.6 (explains how to upgrade to 10.6) has its own Java maximum, discussed here, which you can get to if you at least have an Intel processor, and may offer some limited additional compatibility, though is not as secure as Java 7.
Note: PowerPC Macs with 800 Mhz dual processor or lower speed (1 Ghz is higher) must update to 10.4.11 to get the latest Java:
Check Apple menu -> About this Mac to find out if that pertains to you.