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 JDK with one click in linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article will explain in detail how to achieve one-click installation of JDK in linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Linux script making

Installjdk script content: export LANG=en_USmkdir-p / usr/local/javatar zxvf jdk-8u201-linux-x64.tar.gz-C / usr/local/javacat / opt/install/java > > / etc/profilesource / etc/profile

The command in the file explains:

Create the jdk installation directory: mkdir-p / usr/local/java

Decompress jdk package: tar zxvf jdk-8u201-linux-x64.tar.gz-C / usr/local/java

Copy the jdk environment variable configuration to the system environment variable configuration file: cat / opt/install/java > > / etc/profile

Refresh the system environment variable configuration file: source / etc/profile

Java script content: export JAVA_HOME=/usr/local/java/jdk1.8.0_201/export JRE_HOME=/usr/local/java/jdk1.8.0_201/jreexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATHexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib:$JRE_HOME/lib

File is configured for the JDK environment variable.

02

-

Script executes operation steps

① create a new / opt/install directory (as long as the path is the same in the script)

② throws installjdk (installation script), java (environment variable configuration script), jdk-8u201-linux-x64.tar.gz (installation package can also be other versions of JDK) into the / opt/install directory

③ gives executable permissions to installjdk scripts

Chmod uplix / opt/install/installjdk

④ executes script to install jdk

/ opt/install/installjdk

⑤ executes the following command to check whether jdk is installed successfully

Java or java-version or javac check whether jdk is installed successfully

This is the end of the article on "how to install JDK with one click on linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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