Install JDK configuration environment variables under windows and Ubuntu

Source: Internet
Author: User

Installation of the JDK environment variable, record it so that it is easy to forget to look, mainly the installation and environment variable configuration under Windows and Ubuntu system

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

Download the JDK for the corresponding system

First, install the JDK Configuration Environment under window:

Installation is simple, choose to store the directory on the line, basically always next.

To configure environment variables:


In the system environment, configure the following:

New Java_home

C:\Program files\java\jdk1.7.0_67 (corresponding installed directory)

New CLASSPATH

.; %java_home%\lib;%java_home%\lib\tools.jar

Edit path Add (suffix add; number)

%java_home%\bin;%java_home%\jre\bin


In the cmd command, enter: java-version If the version information appears, the configuration is successful.



Second, the Linux system Ubuntu installation JDK configuration environment:


Download the Linux version of the JDK to the download directory

1. Create the JVM directory and extract the downloaded compressed files to the JVM and rename them to the Java folder

$ sudo MKDIR/USR/LIB/JVM
$ sudo tar zxvf jdk-8u25-linux-i586.tar.gz-c/USR/LIB/JVM
$ CD/USR/LIB/JVM
$ sudo mv jdk1.8.0_25 Java


2. Add an environment variable (~ represents the root directory of the current user)

$ sudo vi ~/.BASHRC

Add the following environment variable configuration content in the tail line:

Export Java_home=/usr/lib/jvm/java
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH


3. Configuring JDK Version Command information

sudo update-alternatives--install/usr/bin/java Java/usr/lib/jvm/java/bin/java 300
sudo update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/java/bin/javac 300
sudo update-alternatives--install/usr/bin/jar Jar/usr/lib/jvm/java/bin/jar 300
sudo update-alternatives--install/usr/bin/javah javah/usr/lib/jvm/java/bin/javah 300
sudo update-alternatives--install/usr/bin/javap JAVAP/USR/LIB/JVM/JAVA/BIN/JAVAP 300

To perform the installation:

sudo update-alternatives--config java


4. Test whether the installation was successful:

$ java-version





Install JDK configuration environment variables under windows and Ubuntu

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.