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

Tutorial on installing and configuring JDK7 under Ubuntu

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces the "installation and configuration of JDK7 tutorial under Ubuntu". In daily operation, I believe that many people have doubts about installing and configuring JDK7 tutorial under Ubuntu. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "installing and configuring JDK7 tutorial under Ubuntu". Next, please follow the editor to study!

The configuration of JDK under Ubuntu is essentially the same as that of win:

1. Go to the official website to download JDK7, find jdk-7u21-linux-i586.tar.gz and download: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

2. Get the folder named jdk1.7.0_21 after decompression, and copy it to / usr/lib/jvm (you need to create a new jvm folder).

3. Configure jdk environment variables:

After starting the terminal and typing

The code is as follows:

Gedit / etc/profile

Add a configuration at the end, save and exit

The code is as follows:

# set jdk environment

Export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21

Export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH

Export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

The terminal enters a command to make the configuration effective.

The code is as follows:

Source / etc/profile

4. Check whether the configuration is successful. Input at the terminal

The code is as follows:

Java-version

If the displayed version is 1.7.0.21, the configuration is successful, as shown below:

The code is as follows:

Java version "1.7.021"

Java (TM) SE Runtime Environment (build 1.7.0_21-b11)

Java HotSpot (TM) Server VM (build 23.21-b01, mixed mode)

If the display is still openJDK, perform step 5 and test again

5. Configure the default JDK,ubuntu. The default JDK is openJDK. Terminal input

The code is as follows:

Sudo update-alternatives-install / usr/lib/java java / usr/lib/jvm/jdk1.7.0_17/bin/java 300

Sudo update-alternatives-install / usr/lib/javac javac / usr/lib/jvm/jdk1.7.0_17/bin/javac 300

Execute the following command, and the configuration requires a default JDK

The code is as follows:

Sudo update-alternatives-config java

The jdk version is listed, where the one marked with "*" is the default JDK. If you want to maintain the current default JDK, just press enter; otherwise, enter the number of the corresponding JDK to set it to the default version.

At this point, the study on "installing and configuring JDK7 under Ubuntu" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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: 271

*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

Servers

Wechat

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

12
Report