Linux Know-How provides a collection of introductory texts on often needed Linux skills.




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 Now, I can compile it using:


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 from which my java "standalone" program was borrowed.

Last Update: 2010-12-16