Reputation: 880
I need to use Java on the command line so I can use a tool called sencha command.
I have java 1.6 and 1.7 installed, but for whatever reason 1.4 is showing up in my command line. Has anyone any idea why this is happeneing and how to fix it. I've searched everywhere for this version on my machine and can't find it. Has anybody got any ideas. Thanks
See screenshot attached.
Upvotes: 0
Views: 216
Reputation: 201399
Assuming your machine is setup the "usual" way, go to your System environment variables and change your "JAVA_HOME" path. Also, on a 64-bit machine you should probably install a 64-bit version of Java, but given what you have here (on the command line) -
set "JAVA_HOME=c:\Program Files (x86)\Java\jdk1.7.0_07"
Upvotes: 0
Reputation: 2379
That is pretty weird. What I would do first is go to your environment path in windows and make sure that the correct path for the latest java is there. That will make it so the java is executed.
Open your environment paths: Windows 8
Drag the Mouse pointer to the Right bottom corner of the screen
Click on the Search icon and type: Control Panel
Click on -> Control Panel -> System -> Advanced
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the new java installation.
Close the window.
Reopen Command prompt window, and run your java -version.
Windows 7
Select Computer from the Start menu
Choose System Properties from the context menu
Click Advanced system settings > Advanced tab
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the new java installation.
Reopen Command prompt window, and run your java -version.
Windows XP
Start -> Control Panel -> System -> Advanced
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the new java installation.
Close the window.
Reopen Command prompt window, and run your java -version.
Upvotes: 0
Reputation: 1301
It seems as if your PATH environment variable is pointing to the old installation of Java.
Go to Control Panel->System->Advanced System Settings->Advanced(Tab)->Environment Variables...
Under the "System Variables" header, you should see a "JAVA_HOME" environment variable, ensure that points to the JRE7 install directory. Similarly, check the "Path" environment variable and make sure the same JRE7 path is in there, in place of the JRE6 install path.
Upvotes: 1