Linux rpm using the installation step jdk

Own use is jkd ​​rpm installation package 

1, download the corresponding installation package rpm, using its own jdk-8u111-linux-x64.rpm this version;

2, the rpm installation package in the directory they want to put, I put under / usr / java directory

  cp / installer start location / usr / java

3, to give permission to install the package:

  chmod 755  jdk-8u111-linux-x64.rpm

4, began to install the rpm package

  rpm -ivh  jdk-8u111-linux-x64.rpm

(Or: rpm -ivh jdk-8u111-linux-x64.rpm --force --nodeps) force the installation

[Here should pay special attention, may not have reported the rpm command, then install the command, then the installation may still fail this time, the order can Cadogan --force --nodeps in the back, indicates a mandatory install, no consider dependent, this will not have any effect]

The installation was successful, appears:

rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing...
Preparing... ################################# [100%]
Updating / installing...
1:jdk1.8.0_111-2000:1.8.0_111-fcs ################################# [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...

(Not necessarily all the same, but these appear xxx.jar ... on the right)

5, configure the environment variables

  vi /etc/profile

Use the edit mode to the last position:

export JAVA_HOME=/usr/java/jdk1.8.0_111
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 
export PATH=$PATH:$JAVA_HOME/bin

[Jdk1.8.0_111 here may, after completion of step 4, first came to the / usr under / java catalog, you can see this thing]

6, execute the following command

  source /etc/profile

7, see jkd version

  java -version

If properly display the installed version, basically successful, but if the pre-existing older version or jkd default jdk version of the class, you need to change it, use the following command:

  update-alternatives --config java

(If the command is not alternatives, the same, the install command, execute: update-alternatives --install / usr / bin / java java /usr/java/jdk1.8.0_111/bin/java 60)  

  Then there will be a few options, and this time choose the jkd version you just installed, and then press Enter, this time to use java -version, you can see the normal jkd version installed yourself!

You can test the following:

  we Hello.java

  Preparation of content:

    class Hello{

      public static void main(String[] args){

        System.out.println("Hello World!");

      }

    }

Once saved, then:

javac Hello.java

java Hello

Normal output:

Hello World 

That success!

Guess you like

Origin www.cnblogs.com/xuehuashanghe/p/12115714.html