For PowerPC machines, see Ubuntu Help Online. |
Java, developed by Sun Microsystems, is and interpreted language which is compiled to bytecode. This bytecode can be run on any Java Virtual Machine, making Java a highly portable language. It is object oriented, has similar syntax to C and is designed to be secure.
Ubuntu supports both Java 1.5 and 1.6 in both Sun and Open Source flavors.
-
Install sun-java5-jdk from the “Multiverse” repository (see Add Applications). You will need to use Synaptic Package Manager to install these packages.
-
Read the Java license presented. You must accept it to continue.
-
To get your system to use Sun Java instead of the open-source (but less functional) GIJ that is installed by default, run:
sudo update-alternatives --config java
and choose the option that has
j2re1.5-sun
in it.
Java 1.6 is also available, and can be installed by following the above directions, swapping all instances of 1.5 to 1.6
-
Install sun-java5-jdk from the “Multiverse” repository (see Add Applications). You will need to use Synaptic Package Manager to install these packages.
-
Read the Java license presented. You must accept it to continue.
-
To get your system to use Sun Java instead of the open-source (but less functional) GIJ that is installed by default, run:
sudo update-alternatives --config java
and choose the option that has
j2re1.6-sun
in it.
Enter the following code into a text editior and save it as "Hello.java":
public class Hello {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
Open a terminal and run your code by typing:
javac Hello.java; java Hello
The Eclipse platform provides a complete, extensible Java development environment.
-
Install the eclipse package from the “Universe” repository (see Add Applications).
-
Press Eclipse.
→ → to start using
The Netbeans platform provides a complete, extensible Java development environment.
-
Install the Netbeans package from the “Universe” repository (see Add Applications).