8.2.12 Java
javac
java
The Java language compiler and interpreter. Under Linux, both javac and java are actually scripts which call kaffe with appropriate options (try cat /usr/bin/java).
A trivial example for a java "standalone" program. I use my favourite text editor, e.g. kate (in X terminal) to type in the following java code:
/* Comments are marked like in C++
* A java class to display "Hello World"
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World.") ; // Print "Hello World." followed by a newline
}
}
I save this into a file named try_java.java. Now, I can compile it using:
javac try_java.java
This creates a file called HelloWorldApp.class which contains the "bytecode" (semi-compiled code which requires an interpreter to run). I can run it on the command line using:
java HelloWorldApp
For an example on how to embed a simple java applet into an html web page, have a look at http://java.sun.com/docs/books/tutorial/getStarted/cupojava/unix.html from which my java "standalone" program was borrowed.
* License

