I'd download and install jdk (a Java Developer's Toolkit) from java.sun.com. There's also a GNU java compiler, but I have no experience with it.
Here's how I set it up: I unpack it and put it in /usr/java, where I create a symlink "jdk" to my "current" version, e.g., jdk -> /usr/java/j2sdk1.4.2_06 (but now Java 1.5 is out, with quite some changes in the syntax). And I make sure /usr/java/jdk/bin is in my path.
For class X, you write source file X.java. You compile it (and, implicitly, any dependencies) with "javac X.java", which produces one or more class files, including X.class. You run the program with "java X", i.e., naming the class not the file.
For an applet, you also have to write an HTML page that contains it. Sun provides appletviewer (now in your path), which you'd run like "appletviewer Y.html". Alternatively, point your favorite browser to file:///home/asahlot/java/Y.html (or wherever it lives).
|