Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Java for Linux 
 

Downloading: First of all download JDK for the Linux (Fedora Core 3) Operating System.

 

Java for Linux

                         


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:

./jdk-1_5_0_01-linux-i586.bin

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:

JAVA_HOME="/usr/java/jdk1.5.0_01"
export JAVA_HOME

/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:

echo $JAVA_HOME

Output should be

/usr/java/jdk1.5.0_01

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:

HelloWorld.java

public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}

Compile the above program by using the following command:

javac Test.java

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
Hello world

or you may execute your program by going inside the bin directory because we are creating the HelloWorld.class file in the bin directory. the class file exists like the below one:

 /usr/java/j2sdk1.4.0/bin/java Test

The Java SDK includes the following commands:

  • javac: Linux Java compiler (i.e. javac program-name.java)
  • java: Byte code interpreter / Java program launcher. (i.e. java program-name Do not include ".class" extension.)
    Test version: java -version
  • appletviewer: Views Java applet embedded in html file. (appletviewer myfile.html)
  • javaws: Java Web Start application manager. Java application handler for browser.
    (Also see YoLinux Mozilla configuration tutorial)
  • javadoc: Generate API documentation from tagged comments.
  • javah: Creates C header and stub files for Java class.
  • javap: Java file disassembler
  • jdb: Java debugger
  • jar: JAR archive file generation tool.

                         

» View all related tutorials
Related Tags: java c com stl process tags custom jstl unity tag community set war group js work to standard unit pos

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.