Question

At the beginning I first installed JDK 7 on my Windows 7 operating system . As usual I added the following path of my newly installed Java Development Kit to the system variable PATH.

C:\Program Files\Java\jdk1.7.0_25\bin

When running javac and java commands in Command Prompt they have both pointed to the same environment. So far so good.


For the purposes of Java application development at our enterprise I was forced to install an older instance of JDK thus installing JDK 6.

Below is the printout of my PATH system variable at the moment.

C:\dev\CollabNet\Subversion Client
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\Program Files\WIDCOMM\Bluetooth Software\
C:\Program Files\WIDCOMM\Bluetooth Software\syswow64
C:\Program Files\Java\jdk1.6.0_37\bin
C:\Development\apache-maven-3.1.1\bin
C:\dev\apache-ant-1.7.1\bin
C:\Program Files\TortoiseSVN\bin

But now I faced the situation where javac and java versions are different therefore pointing to different environments.

C:\Users\rokprodan>javac -version
javac 1.6.0_37

C:\Users\rokprodan>java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Does anybody have any suggestions and ideas for this situation? How could I achieve that both javac and java are pointing to JDK 6 ?

I deep appreciate your advices and help.

Was it helpful?

Solution

When you installed public JRE, java.exe was put into C:\WINDOWS\system32. But javac is not a part of JRE, so it is can be found only in C:\Program Files\Java\jdk1.6.0_37\bin.

The solution is to place C:\Program Files\Java\jdk1.6.0_37\bin before C:\WINDOWS\System32 in PATH environment variable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top