如何在其他Java版本的机器上安装Java 8 [英] How to install Java 8 on machine with other Java versions

查看:110
本文介绍了如何在其他Java版本的机器上安装Java 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在其他几个版本的机器上安装了Java 8(jdk-8u60-windows-x64.exe)。

I installed Java 8 (jdk-8u60-windows-x64.exe) on machine with several other versions.

安装后我看到以下消息

d:\Userprofiles\user>java -version
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

我可以将 JAVA_HOME 更改为新位置但这并不能解决上述问题。

I can change JAVA_HOME to the new location but this does not fix the above message.

当我编辑注册表并在几个注册表项中更改 1.8 1.7 我再次有一个工作配置。但这仍然是 1.7。

When I edit the registry and change 1.8 in serveral registry keys to 1.7 I have a working configuration again. But this is still 1.7.

更改 JAVA_HOME 似乎没有任何影响。当我将其更改为新安装的JDK时

Changing JAVA_HOME does not seem to have any effect. When I change it to my new installed JDK

d:\Userprofiles\user>java -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)

d:\Userprofiles\user>echo %JAVA_HOME%
D:\Program Files\Java\jdk1.8.0_60

在我的机器上运行1.8需要做什么? JAVA_HOME 现在似乎已经过时了,我应该更改注册表吗?我应该怎么做才能更改注册表,以便获得1.8版本?

What do I need to do to have 1.8 working on my machine? JAVA_HOME seems obsolete now, should I change the registry? What should I do to change registry so that picks up the 1.8 version?

推荐答案

仅仅引入<的值是不够的code>%JAVA_HOME%(实际上,Java并不关心是否存在这样的环境变量)。

It's not enough just to introduce the value for %JAVA_HOME% (actually, Java doesn't care if there is or there isn't such environment variable).

您要做的是将%JAVA_HOME%/ bin 目录附加到 Path 环境变量,以便您获取与%JAVA_HOME%版本匹配的 java.exe ,而无需写入<$的完整路径c $ c> java.exe 您要触发的可执行文件。

What you have to do is to append %JAVA_HOME%/bin directory to the Path environment variable, so that you get the java.exe that matches the %JAVA_HOME% version, without having to write the full path to the java.exe executable that you want to trigger.

所以,要么这样做:


  • %JAVA_HOME%环境变量设置一个值

  • 追加%JAVA_HOME%/ bin 路径环境变量

  • set a value for the %JAVA_HOME% environment variable
  • append %JAVA_HOME%/bin to the Path environment variable

或只是


  • 追加<--java-home-directory> / bin 路径 vari能够。

  • append <the-java-home-directory>/bin to the Path variable.

就个人而言,我更愿意维持 JAVA_HOME 的价值,因为Maven,Hadoop等工具需要它。

Personally, I would prefer to maintain a value for JAVA_HOME, as it is needed by tools like Maven, Hadoop, etc.

这篇关于如何在其他Java版本的机器上安装Java 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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