0

I have a POS that has to be run on java7 and I checked the current version by typing java -version on the command prompt and got the following output:

java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

Since I want java7, I thought of editing the environment variables to point to jdk1.7 and when I checked the variables, it was as follows:

enter image description here

I see that it is already pointing to java7 jdk. How is this possible and how to run java7?

UPDATE:

The system variables PATH enter image description here

I think I figured out the problem but not the solution. The first system variable - C:\ProgramData\Oracle\Java\javapath is causing the trouble here, which has a java.exe in the given path. It might be a product of me directly upgrading java from java7 to java8. But if I remove it, it causes an error in cmd. What could be done?

S.Dan
  • 1,733
  • 3
  • 21
  • 43
  • Related: [Is there an equivalent of 'which' on the Windows command line?](http://stackoverflow.com/q/304319/978917). – ruakh Feb 12 '17 at 04:25
  • 1
    I imagine when it comes to system variables, first come, first serve. You need to look at the system path to figure out where it's coming from. – Christopher Schneider Feb 12 '17 at 04:31

3 Answers3

0

First thing is, We are not able to see full value of "PATH" variable under user variables section.

I see that it is already pinting to java7 jdk. How is this possible

Usually "JAVA_HOME" is set by apache tomcat service installer since tomcat can only find Java through "JAVA_HOME" variable.

and how to run java7?

In the PATH variable after ruby and python find whether there is jdk 1.8 mentioned anywhere. And replace that with the jdk 1.7 path or you can refer JAVA_HOME in PATH as %JAVA_HOME%

eg: PATH = C:\Ruby....;%JAVA_HOME%\bin;
learner
  • 214
  • 3
  • 15
  • I updated the question by adding the user variables - but there is no java pointer there. In the system variables there is, but it is still jdk1.7 – S.Dan Feb 12 '17 at 05:39
0

You are mixing two things. 1. Java home : if you try to echo JAVA_HOME it will point to jdk1.7 ... as you are mentioning. Many of the programs/applications use this env variable to locate java. 2. Path variable : This is where the executables are located. So if you try to run some program/executable, system will try to locate the executable using list of path items. So this should point to jdk 7 if you want to use java directly.

DNAj
  • 220
  • 3
  • 9
0

After hours of research I found the problem and the solution, which was quite simple.

Since I used the java notification to upgrade to java8, that had entered the C:\ProgramData\Oracle\Java\javapath to the system variables which had been sort of a pointer to the new jdk.

In order to use java7, I simply needed to bring the jdk1.7 pointer to the top.

S.Dan
  • 1,733
  • 3
  • 21
  • 43