Downloading: First of all download JDK for the Linux (Fedora Core 3) Operating System. To download the latest version of jdk, click on the link http:/www.java.sun.com. and download the latest version for Linux Operating System. I have downloaded jdk-1_5_0_01-linux-i586.bin for this tutorial.
Installing: Now install the downloaded version at your machine. To install change the directory where you have downloaded the SDK ( I have downloaded it in my home directory /home/deepak) and execute self-extracting binary file by using the following command:
|chmod +x jdk-1_5_0_01-linux-i586.bin|
On running, the self-extracting binary file displays the License agreement text asking you for the acceptance to the agreement:
Above command should create a directory called jdk1.5.0_01 in the /home/deepak directory. Move the SDK directory to /usr/java/. Create /usr/java if doesn't exist. Here is the command used:
|mv jdk1.5.0_01 /usr/java|
Set the JAVA_HOME environment variable, by modifying /etc/profile so it includes the following:
/etc/profile is run at startup and when a user logs into the system, so you will need to log out and log back in for JAVA_HOME to be defined.
Make sure that JAVA_HOME is defined correctly by using the command below. You can find the to your Java SDK by using the following command:
Output should be
Now you have successfully download and install JDK at your machine. Now its time to develop and run a simple Hello World java program.
Lets create a simple Hello World java program:
Compile the above program by using the following command:
or you may compile the program by going inside the bin directory because we have save the program in the bin directory.
(or /usr/java/j2sdk1.4.0/bin/javac Test.java)
But note here that the file name and the class name must be same. The results into creating the HelloWorld.class file.
Now we have to execute the compiled program, for this we have execute the following command that shows the output of the given program.
|[prompt]$ java Test
The Java SDK includes the following commands:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: December 13, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles