Windows to install multiple versions of JDK on the same machine, modify the environment variable does not take effect problem handling method

Source: Internet
Author: User

Windows to install multiple versions of JDK on the same machine, modify the environment variable does not take effect problem handling method

The machine has jdk1.7 installed, and earlier projects need to rely on jdk1.6, so both jdk1.6 and jdk1.7 are installed natively.

Before installing jdk1.6, perform java-version to get

C:\users\liuxiang2>java-version

Javaversion "1.7.0_21"

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

Javahotspot (TM) Client VM (Build 23.21-b01, mixed mode,sharing)


After installing jdk1.6, and modifying the environment variable Java_home to C:\jdk1.6.0. When you execute java-version again, it still shows:

C:\users\liuxiang2>java-version

Javaversion "1.7.0_21"

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

Javahotspot (TM) Client VM (Build 23.21-b01, mixed mode,sharing)


It seems that the new environment variable java_home=C:\jdk1.6.0 does not take effect. Find a lot of information on the Internet to find:

When installing JDK1.7 (this machine first installs the jdk1.7 again installs the jdk1.6), automatically copies Java.exe, Javaw.exe, javaws.exe three executable files to the C:\Windows\System32 directory, Because this directory takes precedence over the environment variables set by the Java_home in Windows environment variables


Solution: Add under the C:\Windows\System32 directory Java.exe,javaw.exe,javaws.exe Delete. When you open a new command-line window, and then execute java-version, you get the desired result.

C:\users\liuxiang2>java-version

Java Version "1.6.0_18"

Java (TM) SE Runtime Environment (build 1.6.0_18-b07)

Java HotSpot (TM) Client VMs (BUILD16.0-B13, mixed mode, sharing)




This article from "There is nothing, know in Providence" blog, please be sure to keep this source http://yangsj.blog.51cto.com/8702844/1745254

Windows to install multiple versions of JDK on the same machine, modify the environment variable does not take effect problem handling method

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.