Install the Java Development Environment in redhat9 Linux and write the "Hello World" program

Source: Internet
Author: User
Install the Java Development Environment in redhat9 Linux and write the "Hello World" program
By: Wu Yin
Date: 2006-06-06
Email: lazy_fox # msn.com
Link: http://blog.csdn.net/wooin/archive/2006/06/12/790763.aspx
Copyright: This article is copyrighted by Wu Yin. It can be freely transmitted and replicated for non-commercial purposes. For business
The purpose of this article is to be approved by the author. Contact info: lazy_fox # msn.com

1. Download web page: http://java.sun.com/j2se/1.5.0/download.jsp
2. Download the JRE installation package: jre-1_5_0_07-linux-i586-rpm.bin under Linux
Download JDK installation package under Linux: jdk-1_5_0_07-linux-i586-rpm.bin
All are in Linux RPM (self-extracting file) format.
3. Create the directory/usr/Java and copy the above two files to the folder.
4. change its attributes to executable files.
5. The procedure is as follows:
$ CD/usr/Java
$ Chmod 777 *
$ LS-l
-Rwxrwxrwx 1 wooin 45 m 2006-06-06 jdk-1_5_0_07-linux-i586-rpm.bin
-Rwxrwxrwx 1 wooin 16 m 2006-06-06 jre-1_5_0_07-linux-i586-rpm.bin
6. Run the two executable files separately and the installation will be completed automatically.
$./Jre-1_5_0_07-linux-i586-rpm.bin
$./Jdk-1_5_0_07-linux-i586-rpm.bin
$ Ls
$ Jdk1.5.0 _ 07 jre1.5.0 _ 07
Jdk-1_5_0_07-linux-i586-rpm jre-1_5_0_07-linux-i586-rpm
Jdk-1_5_0_07-linux-i586-rpm.bin jre-1_5_0_07-linux-i586-rpm.bin
7. The installation has been completed. You can delete the installation file and keep only the jdk1.5.0 _ 07 and jre1.5.0 _ 07 folders.
8. Set Firefox:
Create a symbolic connection in the Firefox plugins folder to point to a Java Library File
$ Ln-S/usr/Java/jre1.5.0 _ 07/plugin/i386/ns7/libjavaplugin_oji.so
9. Set environment variables: In ~ /Add the following lines at the end of the bashrc File
Export java_home =/usr/Java/jdk1.5.0 _ 07
Export classpath =.:/usr/Java/jdk1.5.0 _ 07/lib/dt. jar:/usr/Java/jdk1.5.0 _ 07/lib/tools. Jar
Export Path = $ path:/usr/Java/jdk1.5.0 _ 07/bin
10. Compile the helloworld program:
Program code:
/*************************************** **
* Helloworld. Java
* Note: The source file name must be the same as the class name, both of which are helloworld.
* Compilation command: javac helloworld. Java
* Run the command: Java helloworld
**************************************** */

Public class helloworld {
Private string hellomsg = "Hello world! ";

Public static void main (string [] ARGs ){
Helloworld hW = new helloworld ();
}

Public helloworld (){
// Display our "Hello World" Message
System. Out. println (hellomsg );
}
}

Compile (make sure you have restarted your computer, or you have run "Export Path = $ path:/usr/Java/jdk1.5.0 _ 07/bin "):
$ Javac helloworld. Java
A helloworld. Class file is generated.
Run the program:
$ Java helloworld
Hello world!


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.