Ingredients required are :
- Java Development Kit (JDK) – openjdk-6-jdk
- Java Runtime Environment (JRE) – openjdk-6-jre
- Text Editor – Gedit
Here am going to install the OpenJDK (aka Open Java Development Kit) which is a free and open source implementation of the Java programming language.
Issue the command
$ sudo apt-get install openjdk-6-jdk
Installing the JDK is enough as it includes the JRE
Now to test java
$ java -version
This shows java has been properly installed on the system ..
Now to start programming
Open your favorite editor and write a simple java program as shown below
Save the file with .java extension …i have saved it as hello.java ..
In terminal navigate to the folder where hello.java file is present and to compile the java file issue the command
$ javac hello.java
If there are any errors in your program the compile will point it out for you..
Now to run the program issue the command
$ java hello
This was a Hello World example in java programming on Linux platform 🙂
Credits : My java faculty @NIIT 🙂