RedHat Linux Server5.4 installation jdk-6u22-linux-x64-rpm.bin

Source: Internet
Author: User


1. check whether JDK is installed java login to the system with the root user, open a terminal input # rpm-qa | grep gcj display content contains the following information # java-1.4.2-gcj-compat-1.4.2.0-40jpp.112 # java-1.4.2-gcj-compat-devel-l.4.2.0-40jpp.112 (this package is not pre-installed) uninstall # rpm-e java-1.4.2-gcj-compat-devel-l.4.2.0-40jpp.112 # rpm-e java-1.4.2-gcj-compat-l.4.2.0-40jpp.112 if there is a dependency, don't let uninstall, just use rpm-e -- nodeps uninstall on the line to download the jdk-6u22-linux-x64-rpm.bin (ORACLE can be found on the official site) 2. add executable permissions to the file [root @ esprit java] # chmod + x j Dk-6u22-linux-x64-rpm.bin 3. run the jdk-6u22-linux-x64-rpm.bin [root @ esprit java] #. /The jdk-6u22-linux-x64-rpm.bin is generated after execution, there are other packages such as sun-javadb 4. install jdk-6u22-linux-x64-rpm [root @ esprit java] # rpm-ivh jdk-6u22-linux-x64-rpm here I jdk installed in the/usr/java directory 5. you can configure environment variables in three ways: Modify the/etc/profile file and modify the environment variables in the user directory. bashrc file, which can be directly modified in shell) Here I will only talk about modifying the/etc/profile file I used [root @ esprit java] # vi/etc/profile after opening the file Ort path user logname mail hostname histsize inputrc is added as follows: export JAVA_HOME =/usr/java/jdk1.6.0 _ 22 export PATH = $ PATH: $ JAVA_HOME/bin: $ JAVA_HOME/jre/binexport CLASSPATH =.: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib: $ CLASSPATH Press esc and enter: wq to save and exit. Make the configuration take effect soure/etc/profile6. write a simple HelloWorld in the test configuration environment to test [root @ esprit java] # vi HelloWorld. in the java file, enter: public class HelloWorld {public static void main (String args []) {System. out. println ("Hello World in Linux !! ") ;}}: Wq save and exit [root @ esprit java] # javac HelloWorld. there is no error in java. Next, [root @ esprit java] # output in java HelloWorld shell: Hello World in Linux !! In this way, the author h405589168 is completed.

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.