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 environment under Linux platform

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to install the JDK environment under the Linux platform, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Linux platform JDK installation

1. Download Java's development package JDK

There are several type versions of JDK, so we only need to choose the version of type Java SE.

Go to the web page: http://www.oracle.com/technetwork/java/javase/downloads/index.html

As shown below:

Here, as developers, we choose JDK instead of JRE, so click the DOWNLOAD button under JDK with the mouse to enter the new web page, as shown below:

There are versions of different platforms available for download. for the Linux platform, there are 32-bit and 64-bit, each of which is divided into rpm and tar.gz files. For Linux systems using rpm management packages, you can download rpm files and install them, or you can download tar.gz files. Linux that does not use the rpm package manager can only use tar.gz files. I use the 32-bit CentOS version 6.2 and choose to download jdk-7u4-linux-i586.tar.gz (Note: CentOS uses the rpm package manager, or you can download jdk-7u4-linux- i586.rpm to install it).

To download the corresponding version, you must accept the corresponding license agreement, which is not accepted by default, as shown in the figure above. Click directly to download and you will be prompted. As shown below:

You must first click the radio button "Accept License Agreement" on the left to accept the corresponding license agreement. After clicking, the web page will look like the following figure:

Then click the mouse to download the corresponding version.

two。 Install JDK

After downloading jdk-7u4-linux-i586.tar.gz, run tar-xvzf jdk-7u4-linux-i586.tar.gz in the Linux terminal to extract it, which will be unzipped in the folder jdk1.7.0_04, and put the entire folder jdk1.7.0_04 in your favorite directory (Note: try not to have Chinese, no spaces). I put it in the / root/work/program_files directory, as shown below:

So far, our JDK has not been set to the environment variable. Run the java-version test as shown in the following figure:

The system is not looking for the path where java is located.

Run the set command and check the environment variables, as shown below:

You can see that there is no path to java in the environment variable PATH, and by default, the system cannot find our JDK.

3. Configure JDK environment variables

Edit the .bash _ profile file in the directory where the user account is located. I use the vi editor, as shown in the following figure:

Add the path where the bin directory in JDK is located in .bash _ profile, as shown in the following figure:

Our directory is at the top, and if you have more than one JDK or JRE, make sure that our JDK is used first. Our jdk1.7.0_04 is in the / root/work/program_files directory, so the added path is / root/work/program_files/jdk1.7.0_04/bin. After saving the file, exit the current user and log in again to ensure that the changes to our configuration file. bash_profile take effect.

Run the set command and check the environment variables, as shown below:

We see that the environment variable PATH already has / root/work/program_files/jdk1.7.0_04/bin, and the configuration is successful.

Run java-version, as shown in the following figure:

This indicates that the JDK is configured successfully, and the version is 1.7.00.004.

At this point, the JDK of our Linux platform is installed.

Thank you for reading this article carefully. I hope the article "how to install JDK environment on the Linux platform" shared by the editor will be helpful to you. At the same time, I also hope you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

Development

Wechat

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

12
Report