|tom panzarella on Sun, 22 Apr 2001 18:43:14 -0400|
As far as another JRE besides IBM's and Blackdown's you can get Sun's. Here is a link to the full on Java SDK from Javasoft's website: http://java.sun.com/j2se/1.3/download-linux.html
This includes a Java Runtime Environment as well as all of the developer tools that you need to have in order to write Java applications. (You probably saw on a thread we had going last week that a few of us have experienced Sun's JDK not working on the new Red Hat 7.1 distribution ... this is actually noted in the distro's RELEASE NOTES ... IBM's did work ... I prefer to use Sun's which is why I'm sticking with RH6.2 for now but that's not the point of this thread...)
As far as getting the source to the JRE class files, you officially can't get it (as far as I know) but there is a really slick Java decompiler that you can get for free called JAD (JAva Decompiler):
So here is an expample of getting to source code to one of the "official" Java classes (I'm not too sure of what your mileage is with Java so, I'm sorry if this seems too elementary ... I will assume nothing):
Assume your JDK is installed in /usr/local/jdk1.3 ...
The Java runtime class files are kept in a JAR (Java ARchive) file located in /usr/local/jdk1.3/jre/lib/rt.jar. Jar files are very similar to Unix tar files, and the JDK comes with a tool called "jar" (located in /usr/local/jdk1.3/bin/ ... I recommend you put this directory in your $PATH environment variable). In a nutshell, the jar tool is used to create .jar files as well as extract files from a jar. So I'd recommend copying /usr/local/jdk1.3/jre/lib/rt.jar to ~/java_temp/ (or some other appropriate directory you can play around in). Then use the jar tool to extract the .class files from the jar:
[you@yourhost java_temp]$ jar xvf rt.jar
Once you do this, the directory structure that is created will reflect the directory structure of the packages that the java .class files are located in. So for example assume you wanted to look at the source code for Sun's implementation of a UnixFileSystem object -- the UnixFileSystem.class is located in the package "java.io", so change to that directory:
[you@yourhost java_temp]$ cd java/io/ [you@yourhost io]$ pwd /home/you/java_temp/java/io [you@yourhost io]$
Now in that directory are all of the classes that live in the java.io package. So lets get the source to UnixFileSystem.class using jad:
[you@yourhost io]$ jad -p UnixFileSystem.class > UnixFileSystem.java
I would recommend putting the jad binary somewhere in your $PATH (I have mine in /usr/local/bin). The "-p" flag tells jad to send output to STDOUT which I'm just redirecting to a java source file. Now you have the source to Sun's implementation of a UnixFileSystem object! Definitely read the notes on the Jad website if you are going to use it for anything *real*. Last I looked hard at the jad website (which was a long time ago) it had said that jad had a hard time handling anonymouns inner classes which is something that is very typically used in writing event handlers for GUI applications using the JFC (Swing classes).
In a nutshell, I'd personally recommend using Sun's Java implementation (for no other reason than personal preference). And to play around with looking at other people's Java source code, "jad" can be a handy little tool at times. I hope this helps.
So the other day I wanted to play some Java games in Konqueror. I'd heard of Blackdown before (used it to run Oracle's OUI), so I downloaded it and installed it. Then I realized that I didn't see source on their web site or their ftp site. I went looking around, on Freshmeat and such, and the only other JRE I found was IBM's (and I don't think you can get the source to that one, either).
-- C-x C-c