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