如果安装了Java 8,则无法使用Java 7安装 [英] Cannot use Java 7 installation if Java 8 is installed

查看:112
本文介绍了如果安装了Java 8,则无法使用Java 7安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常仍然将Java 7用于我的所有编码项目(这是公司的政治问题),但是我为一个我正在贡献的第三方项目安装了Java 8。现在,似乎我不能在Windows 7 x64中安装Java 8,并且默认情况下仍然使用Java 7:

I normally still use Java 7 for all my coding projects (it's a company "politics" issue), but I installed Java 8 for one third-party project I am contributing to. Now, it seems I cannot have Java 8 installed in Windows 7 x64, and still use Java 7 by default:

C:\>"%JAVA_HOME%\bin\java.exe" -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

C:\>java.exe -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

如您所见,JAVA_HOME完全被忽略。

As you can see, JAVA_HOME is completely ignored.

我也有路径中的Java,使用%JAVA_HOME%\ bin,当我在DOS框中检查路径时,它正确地解析为Java 7,但它仍然没有区别。

I also have Java in the path, using "%JAVA_HOME%\bin", which resolve correctly to Java 7 when I check the path in a DOS box, but it still makes no difference.

我检查了Java控制面板(不确定这是否会影响默认的命令行Java版本)。在Java选项卡的View ...按钮下,您可以看到已注册的Java版本。我可以在用户选项卡下添加所有版本,但在系统下只有Java 8,无法更改它。

I checked in the "Java Control Panel" (not sure if this affects the default command-line Java version). Under the "Java" tab, the "View..." button, you get to see "registered" Java versions. I can add all the versions under the "User" tab, but under "System" there is only Java 8, and no way to change it.

我错过了什么,或者除了我卸载Java 8之外,Oracle是否只能使用Java 7?我不想在任何地方指定源和目标,我甚至不知道是否可以在任何地方指定它,使用Java。

Am I missing something, or did Oracle just make it impossible to use Java 7, unless I de-install Java 8? I don't want to have to specify the "source" and "target" everywhere, and I don't even know if it is possible for me to specify it everywhere, where Java is used.

编辑:我做的是我卸载了所有Java。然后安装最新的Java7(86和x64),然后安装最新的Java8(86和x64)。在我这样做之后,我注意到x64 JDK 已经消失了。似乎Java8杀了它。所以我重新安装了JDK 7 x64,之后 JDK 8 x64。尽管如此,JDK7 x64似乎并没有替换复制到Windows目录本身的java.exe(我假设这就是问题)。

What I did is I de-installed all Java. Then installed the latest Java7 (both 86 and x64), and then the latest Java8 (both 86 and x64). After I did that, I noticed that the x64 JDK was gone. It seems Java8 killed it. So I re-installed the JDK 7 x64, after the JDK 8 x64. Still, JDK7 x64 did not seem to "replace" the "java.exe" which is copied into the "Windows" directory itself (I assume THAT is the problem).

推荐答案

Windows和Unix都使用 PATH 环境变量查找程序。您的 Windows \ System32 中有一个 java.exe ,它出现在您的首选Java版本之前。

Windows and Unix both find programs using their PATH environment variable. You have an java.exe in your Windows\System32 which is appearing before your "preferred" version of Java.

将PATH更改为您需要的路径,或在需要其他版本时指定完整路径。

Change the PATH to be the one you need, or specify the full path when you need a different version.

这篇关于如果安装了Java 8,则无法使用Java 7安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆