Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install java on linux system

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the knowledge of "how to install java on linux system". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

How to install java (jre or jdk) on ubuntu server, mainly pay attention to the following points: (also applicable on CentOS,RedHat)

1. Download the java version you want.

JRE download: http://java.com/en/download/manual.jsp;(generally download JDK directly)

JDK Download: www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

2. Assuming you downloaded jdk, copy the jdk archive jdk-8u131-linux-x64.tar.gz to/usr/lib/jvm. If there is no such folder, it will be automatically created:

cp jdk-8u131-linux-x64.tar.gz /usr/lib/jvm

Switch to/usr/lib/jvm and extract it in that directory:

cd /usr/lib/jvmtar xf jdk-8u131-linux-x64.tar.gz

3. Modify environment variables:

#vim ~/.bashrc

#Add the following (#sign not required in VIM)

#export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_131

#export CLASSPATH=.:$ {JAVA_HOME}/lib:${JRE_HOME}/lib

#export PATH=${JAVA_HOME}/bin:$PATH

#Save and make it effective

#source ~/.bashrc

4. Configure default programs

#update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_131/bin/java 50

# update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_131/bin/javac 50

# update-alternatives --config java

#If you have other jdk installed in your system, the system will prompt you, select jdk1.8.0_131

Note: If you install jre, just configure the first item above, that is: java

5. Test installation is complete

#java -version

java version "1.8.0_131"

Java(TM) SE Runtime Environment (build 1.8.0_131-b11)

Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

If the correct version information appears, such as java version jdk1.7.0_17, the installation is complete;

If the following results appear, there is a problem with the installed version, such as 32-bit java installed on a 64-bit system.

-bash: /usr/bin/java: No such file or directory

This problem can be solved by the following command:

sudo apt-get install libc6-i386

When you use java -version again, the correct version information appears.

Now that the Java environment is fully configured, you can happily write Java programs.

"How to install java on linux system" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report