Windows+linux JDK Installation and Java environment variable configuration

Source: Internet
Author: User

For novice Java users, perhaps the first thing to do is to install the JDK and configure the environment, the following mainly on Windows and Linux under the installation of the JDK and environment variables configuration.

1, first download the corresponding platform available version JDK installation files, you can download windows, Mac or Linux version on the Oracle official website;

can also go to my Baidu network disk download: Windows version (Jdk-8u20-windows-x64.exe), Linux version (jdk-8u20-linux-x64.tar.gz)

2, after the download, directly installed to the corresponding directory of the computer, Windows directly double-click Follow the prompts to install the default, you can also change the installation path;

Running terminal under Linux:

Switch to the directory of your JDK files

~/downloads/

Remember to place the red part of your own file path in the text;

Unzip the file as follows:

Tar jdk-8u20-linux-x64. tar. GZ

The red part is the JDK file name;

At this time, there will be a folder named Jdk1.8.0_20 in the current directory;

The JDK file is typically moved to the /usr/local/directory, so run the following command:

sudo MV Jdk1. 8. 0_20/usr/local/

The red part is the directory of the JDK files you just extracted, the green part is the path you want to move to;

After this part of the JDK is installed successfully, the next left the configuration environment;

3. Configuring the Java Operating environment

  Under Windows:

Open Control Panel, enter the system--Advanced system settings--environment variables, and make the following settings in the system environment variables:

This assumes that your JDK file is installed in C:/Program files (X86)/java/;

Add C:/Program Files (X86)/java/jdk1.8.0_20/bin behind the PATH environment variable; C:/Program Files (X86)/java/jdk1.8.0_20/jre/bin;

Remember and already have environmental variables separated by semicolons;

New java_home environment variable, content fill in: C:/Program Files (X86)/java/jdk1.8.0_20/;

Edit the CLASSPATH environment variable, plus: C:/Program Files (X86)/java/jdk1.8.0_20/lib;

Save,

Open cmd Command Line window Test: Enter Java-version if the current version of Java installed indicates that the installation was successful,

If you fail, reboot the system and test again.

  Under Linux:

Run the following command in the terminal:

  

sudo gedit/etc/environment

Open the environment variable configuration file, and add/usr/local/jdk1.8.0_20/bin/to your JDK path behind path, and remember to separate it from the front with a colon;

Restart a line to add the following:

classpath=.:/ usr/local/jdk1.8.0_20/lib/pay attention to the front of the small dot do not lose;

On the restart line join:

java_home=/usr/local/jdk1.8.0_20/

Then save, restart the system can be effective;

Run java-version in the terminal to test, the Java version appears to indicate success!

  

Windows+linux JDK Installation and Java environment variable configuration

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.