Modifying environment variables does not work after Windows installs multiple versions of the JDK

Source: Internet
Author: User

The machine has jdk1.6 installed, and earlier projects need to rely on jdk1.5, so both jdk1.5 and jdk1.6 are installed natively.
Before installing jdk1.5, perform java-version to get
Java Version "1.6.0_38"
Java (TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot (TM) 64-bit Server VM (build 20.13-b02, Mixed mode)

After installing jdk1.5, and modifying the environment variable Java_home to D:\devSoftware\jdk1.5. When you execute java-version again, it still shows:
Java Version "1.6.0_38"
Java (TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot (TM) 64-bit Server VM (build 20.13-b02, Mixed mode)

It seems that the new environment variable java_home=d:\devsoftware\jdk1.5 is not in effect. Find a lot of information on the Internet to find:
When installing JDK1.6 (this machine first installs the jdk1.6 again installs the jdk1.5), 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: Remove the Java.exe,javaw.exe,javaws.exe. When you open a new command-line window, and then execute java-version, you get the desired result.
Java Version "1.5.0_17"
Java (TM) 2 Runtime environment, Standard Edition (build 1.5.0_17-b04)
Java HotSpot (TM) 64-bit Server VM (build 1.5.0_17-b04, Mixed mode)

Modifying environment variables does not work after Windows installs multiple versions of the JDK

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.