Replacement of the Java version

Source: Internet
Author: User

  1. Previous steps for installing the Java Environment (teacher-given, including installing Tomcat)


  2. Step 1 install tomcat You must install the JDK before you install Tomcat. The full name of the JDK is Java development kit, a software development kit for the Java language provided by Sun Inc., which contains the Java Virtual Machine (JVM). The compiled Java source program compiles Java bytecode, and as long as the JDK is installed, the JVM can be used to interpret the bytecode files, thus ensuring the cross-platform of Java. JSP source code run  ---> compile (bytecode)---> run (JVM) jdk    jvm rpm -ivh  Jdk-7u45-linux-i586.rpmvim /root/.bash_profile#appendjava_home=/usr/java/jdk1.7.0_45path= $JAVA _home/bin:$ PATH: $HOME/binclasspath=.: $JAVA _home/lib/tools.jar: $JAVA _home/lib/dt.jarexport path java_home  classpath catalina_homesource .bash_profile[[email protected] ~]# java - versionjava version  "1.7.0_45" Java (TM)  SE Runtime Environment  (build 1.7.0_ 45-B18) Java hotspot (TM)  Client VM  (build 24.45-b08, mixed mode,  Sharing)  tar -zvxf apache-tomcat-8.0.0-RC10.tar.gz -C /var/www/html/mv  Apache-tomcat-8.0.0-rc10 tomcat[[email protected] bin]# /var/www/html/tomcat/bin/startup.sh using catalina_base:   /var/www/ html/tomcatusing catalina_home:   /var/www/html/tomcatusing catalina_tmpdir: / var/www/html/tomcat/tempusing jre_home:        /usr/java/jdk1.7.0 _45using classpath:       /var/www/html/tomcat/bin/bootstrap.jar:/var/ www/html/tomcat/bin/tomcat-juli.jarhttp://localhost:8080/cd /var/www/html/tomcat/webapps/root/echo  ' <%= new java.util.date ()  %> '  > test.jsphttp://localhost:8080/test.jsp

3.

1. First look at the version of the system that comes with the JDK:

[Email protected] ~]# java-version
Java Version "1.4.2"
Gij (GNU libgcj) version 4.1.2 20071124 (Red Hat 4.1.2-42)


2. Determine the specific version number of the JDK and then uninstall it

[Email protected] soft]# Rpm-qa | grep JDK
[Email protected] soft]# Rpm-qa | grep GCJ
Libgcj-4.1.2-42.el5
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
First, confirm the specific version number of the JDK, and then
[Email protected] jdk1.6.0_11]# yum-y Remove java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

Setting up Remove Process
Resolving Dependencies ...... (Start uninstall)
。。。。
Resolver.i386 0:1.1-1jpp.12

complete! (Uninstall complete)


To start the manual installation, the installation package I used is jdk-6u21-linux-i586.bin
Assign permissions to Jdk-6u11-linux-i586.bin, specifically to give it permission to execute.
[Email protected] soft]# chmod +x jdk-6u11-linux-i586.bin
Then unzip:./jdk-6u11-linux-i586.bin
[Email protected] soft]#./jdk-6u11-linux-i586.bin

After the execution there will be a bunch of agreement or something, all the way down. Then there is a confirmation installation, enter Yes, and then enter. Start unpacking. One until

Java (TM) SE Development Kit 6 successfully installed.
.........
Press Enter to continue .....
Done.

The extracted files are as follows:
[[email protected] soft]# ls 
jdk1.6.0_21 jdk-6u11-linux-i586.bin
[[ Email protected] soft]# cd jdk1.6.0_11
[[email protected] soft]# mv jdk1.6.0_11/usr/local
[[email  Protected]/]# cd/usr/local
bin etc games include jdk1.6.0_11 Lib libexec sbin share src
Well, the JDK has been successfully transported to/usr/. Local, and then the last step, set the environment variable. Here are two settings, one is the temporary effect through the export settings, after restarting the settings will be lost, one is to write the settings to the/etc/profile file, can be effective. So, the best setting is of course written in the file. Execute the following command first:
[[email protected] jdk1.6.0_11]# vi/etc/profile
After opening the profile file, enter I into insert mode and add the following to the file.

Java_home=/usr/java/jdk1.6.0_32

Path= $JAVA _home/bin: $PATH: $HOME/bin

Classpath=.: $JAVA _home/lib/tools.jar: $JAVA _home/lib/dt.jar

Export JAVA_HOME=/USR/LOCAL/JDK1.6.0_32

Export path= $PATH: $JAVA _home/bin

Export classpath=.: $JAVA _home/lib/tools.jar: $JAVA _home/lib/rt.jar

[Email protected] local]# Source/etc/profile
Of course, if you like to restart, you can reboot.



Or put it under the/usr/java under the/root/.bash_profile to change to 1.6 other unchanged


Replacement of the Java version

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.