命令行上的Java版本显示与安装的内容不同

时间:2014-06-05 14:52:26

标签: java extjs command-line

我需要在命令行上使用Java,因此我可以使用名为sencha命令的工具。

我安装了java 1.6和1.7,但无论出于什么原因,1.4都出现在我的命令行中。有谁知道为什么会发生这种情况以及如何解决它。我在我的机器上到处搜索这个版本,但找不到它。有没有人有任何想法。感谢

见附件截图。

enter image description here

3 个答案:

答案 0 :(得分:1)

好像你的PATH环境变量指向旧的Java安装。

转到控制面板 - >系统 - >高级系统设置 - >高级(标签) - >环境变量...

在“系统变量”标题下,您应该看到“JAVA_HOME”环境变量,确保指向JRE7安装目录。同样,检查“Path”环境变量并确保其中存在相同的JRE7路径,而不是JRE6安装路径。

答案 1 :(得分:0)

这很奇怪。我首先要做的是转到windows中的环境路径,并确保最新的java路径正确。这将使java执行。

打开您的环境路径: 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.

答案 2 :(得分:0)

假设您的计算机以“常规”方式设置,请转到系统环境变量并更改“JAVA_HOME”路径。此外,在64位计算机上,您可能应该安装64位版本的Java,但是根据您所拥有的(在命令行上) -

set "JAVA_HOME=c:\Program Files (x86)\Java\jdk1.7.0_07"
相关问题