编程知识 cdmana.com

[Linux] build JDK environment with Linux server


First , Of course, to download Linux Of JDK Slightly .

Look at you first Linux How many bits does the system have :

      
      
getconf LONG_BIT
  • 1.

【Linux】Linux Server setup JDK Environmental Science _linux

Then go to download the corresponding JDK digit edition .— Go to Google search by yourself

Here's what I downloaded :jdk-7u79-linux-x64.tar.gz

First I created 2 A folder :

      
      
mkdir -p /java/jdk
  • 1.

jdk-7u79-linux-x64.tar.gz I put it in java Under the table of contents

      
      
java -version # Check to see if the server has been installed jdk
  • 1.

I haven't installed , Will prompt

-bash: java: command not found

Extract the configuration and install jdk1.7:

      
      
tar zxvf /java/jdk-7u79-linux-x64.tar.gz -C /java/jdk
  • 1.

【Linux】Linux Server setup JDK Environmental Science _javascript_02

Unzip all to jdk The directory .

mv Command to complete file rename :

      
      
mv /java/jdk/jdk1.7.0_79 /java/jdk/java7
  • 1.

【Linux】Linux Server setup JDK Environmental Science _javascript_03

add to jdk1.7 To system environment variables :

      
      
cp /etc/profile /etc/profile.bak # Backup
  • 1.
      
      
vi /etc/profile # edit , Add the following at the end
  • 1.
      
      
export JAVA_HOME=/java/jdk/java7
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
  • 1.
  • 2.
  • 3.
  • 4.

【Linux】Linux Server setup JDK Environmental Science _ Blog _04

How to save and exit editing after editing .

According to the first :Esc –> :wq –> enter

      
      
source /etc/profile    # Make the profile effective immediately
  • 1.

Test for successful installation :

      
      
java -version # Test success
  • 1.

【Linux】Linux Server setup JDK Environmental Science _linux_05

This is the jdk1.7 Installation is successful .

If you download jdk yes rpm Suffix :

Install with this command

      
      
rpm -ivh ***( The file name you downloaded ).rpm
  • 1.

Will be installed to /usr/java Below directory


author : Familiar with memory , All rights reserved .


版权声明
本文为[51CTO]所创,转载请带上原文链接,感谢
https://cdmana.com/2022/134/202205141232026022.html

Scroll to Top