//
you're reading...
Java, Programming

Brewing Your First Cup of Java on Linux

This is a tutorial on Java Programming in Linux Platform

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 🙂

Advertisements

About Suhas Dwarakanath

Embedded Engineer interested in Electronics and GNU/Linux

Discussion

Trackbacks/Pingbacks

  1. Pingback: Brewing Java Using GNU gcj « Suhas Dwarakanath - February 22, 2011

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: