This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
All Java 1.4 releases have passed End of Life. You really shouldn't be attempting to use any of those versions, especially since Java's backwards-compatibility features mean that a 1.5 or 1.6 JVM should be able to execute anything that the 1.4 JVMs did.
Every shell process in UNIX has its own execution path. So when you spawn the new process, if you want an implicit java execution ability, you'd add the JRE bin directory to that path. You can also skip that and simply run the "java" command using an absolute path.
Java does not use environment variables. There are some conventions that a lot of Java apps use, however. One of them is that JAVA_HOME points to the directory containing the app's Java root. So it's common to find stuff like this in a ".bashrc" script, which is the script that the bash shell executes when you log in.
Different systems install JDKs and JREs in different places, but the Sun RPM always puts them under /usr/java. I think that this is a very good way to do it.
Oddly enough, their installation for multiple versions of JREs and JDKs in Solaris isn't nearly so tidy or flexible, even though they own Solaris.
An IDE is no substitute for an Intelligent Developer.
It entirely depends on which version of UNIX you are talking about. Different vendors have their own implementations of Java for their particular version of UNIX - for example IBM has Java for AIX, HP has Java for HP-UX and OpenVMS, and for Solaris from Sun you'll need Sun's Java implementation.
Which UNIX are you using? Ask the vendor, or look on the website of the vendor, for Java and instructions on how to install or upgrade it.
Tim Holloway wrote:All Java 1.4 releases have passed End of Life. You really shouldn't be attempting to use any of those versions, especially since Java's backwards-compatibility features mean that a 1.5 or 1.6 JVM should be able to execute anything that the 1.4 JVMs did.
That's true, but Sun has an extended support program for old Java versions: Java for Business, for companies that don't want or can't upgrade to a newer version of Java. Ofcourse you'll have to pay Sun for support if you need that.
Oh, I just saw that the Java for Business website mentions that Java SE 5.0 has gone EOL since yesterday (October 30, 2009).