如何更改Windows(7)上的Java运行时版本?

时间:2021-11-27 07:26:40

How can I change the Java Runtime Version on Windows.

如何在Windows上更改Java运行时版本。

I installed Java 7 for some tests, and now I need the old java6 as system default, but I don't want to uninstall the Java 7 (I need it for later tests). Can I change the system-used JRE in the control panel/Java/JRE tab? I can change/edit/add/delete the user-used version, but not the system-used.

我为一些测试安装了Java 7,现在我需要旧的java6作为系统默认,但是我不想卸载Java 7(我需要它用于以后的测试)。我可以在控制面板/Java/JRE标签中改变系统使用的JRE吗?我可以更改/编辑/添加/删除用户使用的版本,但不能更改系统使用的版本。

8 个解决方案

#1


73  

For Java applications, i.e. programs that are delivered (usually) as .jar files and started with java -jar xxx.jar or via a shortcut that does the same, the JRE that will be launched will be the first one found on the PATH.

对于Java应用程序,即以.jar文件的形式交付(通常)并以Java -jar xxx开头的程序。jar或通过同样的快捷方式,将被启动的JRE将是在路径上找到的第一个JRE。

If you installed a JRE or JDK, the likely places to find the .exes are below directories like C:\Program Files\JavaSoft\JRE\x.y.z. However, I've found some "out of the box" Windows installations to (also?) have copies of java.exe and javaw.exe in C:\winnt\system32 (NT and 2000) or C:\windows\system (Windows 95, 98). This is usually a pretty elderly version of Java: 1.3, maybe? You'll want to do java -version in a command window to check that you're not running some antiquated version of Java.

如果你安装了JRE或JDK,可能找到像C:\Program Files\JavaSoft\JRE\x.y.z. . exe低于目录但是,我已经发现一些“out of the box”Windows安装程序(也有)有java拷贝。exe和javaw。\winnt\system32 (NT和2000)或C:\windows\系统(windows95, 98)。这通常是较老版本的Java: 1.3,可能吧?您将希望在命令窗口中执行java版本,以检查您没有运行过时的java版本。

You can of course override the PATH setting or even do without it by explicitly stating the path to java.exe / javaw.exe in your command line or shortcut definition.

当然,您可以重写路径设置,甚至不用它,只需显式地声明到java的路径。exe / javaw。在命令行或快捷方式定义中的exe。


If you're running applets from the browser, or possibly also Java Web Start applications (they look like applications insofar as they have their own window, but you start them from the browser), the choice of JRE is determined by a set of registry settings:

如果您正在浏览器中运行applet,或者可能还在运行Java Web Start应用程序(它们看起来像应用程序,因为它们有自己的窗口,但是您可以从浏览器中启动它们),那么JRE的选择是由一组注册表设置决定的:

Key: HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment
Name: CurrentVersion
Value: (e.g.) 1.3

More registry keys are created using this scheme:

更多的注册表项使用此方案建立:

(e.g.) 
HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\1.3   
HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\1.3.1

i.e. one for the major and one including the minor version number. Each of these keys has values like these (examples shown):

即一个是主版本,一个包括副版本号。每一个键都有如下的值(如示例所示):

JavaHome    : C:\program Files\JavaSoft\JRE\1.3.1
RuntimeLib  : C:\Program Files\JavaSoft\JRE\1.3.1\bin\hotspot\jvm.dll
MicroVersion: 1

... and your browser will look to these settings to determine which JRE to fire up.

…您的浏览器将查看这些设置,以确定要启动哪个JRE。

Since Java versions are changing pretty frequently, there's now a "wizard" called the "Java Control Panel" for manually switching your browser's Java version. This works for IE, Firefox and probably others like Opera and Chrome as well: It's the 'Java' applet in Windows' System Settings app. You get to pick any one of the installed JREs. I believe that wizard fiddles with those registry entries.

由于Java版本的更改非常频繁,现在有一个“向导”称为“Java控制面板”,用于手动切换浏览器的Java版本。这适用于IE、Firefox,可能还适用于Opera和Chrome等:它是Windows系统设置应用中的“Java”applet。我相信巫师会摆弄那些注册表条目。

If you're like me and have "uninstalled" old Java versions by simply wiping out directories, you'll find these "ghosts" among the choices too; so make sure the JRE you choose corresponds to an intact Java installation!

如果您像我一样,通过删除目录“卸载”旧Java版本,您将在选项中找到这些“幽灵”;因此,请确保您选择的JRE符合完整的Java安装!


Some other answers are recommending setting the environment variable JAVA_HOME. This is meanwhile outdated advice. Sun came to realize, around Java 2, that this environment setting is

一些其他的答案建议设置环境变量JAVA_HOME。同时,这也是过时的建议。Sun在Java 2周围逐渐认识到,这个环境设置是

  1. unreliable, as users often set it incorrectly, and
  2. 不可靠,因为用户经常设置错误
  3. unnecessary, as it's easy enough for the runtime to find the Java library directories, knowing they're in a fixed path relative to the path from which java.exe or javaw.exe was launched.
  4. 不需要,因为运行时很容易找到Java库目录,知道它们相对于Java的路径处于固定的路径中。exe或javaw。exe。

There's hardly any modern Java software left that needs or respects the JAVA_HOME environment variable.

几乎没有任何现代Java软件需要或尊重JAVA_HOME环境变量。


More Information:

更多信息:

...and some useful information on multi-version support:

…以及一些关于多版本支持的有用信息:

#2


57  

I use to work on UNIX-like machines, but recently I have had to do some work with Java on a Windows 7 machine. I have had that problem and this is the I've solved it. It has worked right for me so I hope it can be used for whoever who may have this problem in the future.

我以前在类unix机器上工作,但最近我不得不在Windows 7机器上使用Java。我遇到过这个问题,这就是我解决的问题。它对我来说是正确的,所以我希望它可以用于任何将来有这个问题的人。

These steps are exposed considering a default Java installation on drive C. You should change what it is necessary in case your installation is not a default one.

考虑到驱动器c上的默认Java安装,这些步骤是公开的。如果您的安装不是默认安装,那么您应该更改它的必要性。

Change Java default VM on Windows 7

Suppose we have installed Java 8 but for whatever reason we want to keep with Java 7.

假设我们已经安装了Java 8,但是出于某种原因,我们希望使用Java 7。

1- Start a cmd as administrator

1-作为管理员启动cmd

2- Go to C:\ProgramData\Oracle\Java

2 -到C:\ ProgramData \甲骨文\ Java

3- Rename the current directory javapath to javapath_<version_it_refers_to>. E.g.: rename javapath javapath_1.8

3-将当前目录javapath重命名为javapath_ 。例如:重命名javapath javapath_1.8

4- Create a javapath_<version_you_want_by_default> directory. E.g.: mkdir javapath_1.7

4-创建一个javapath_ 目录。例如:mkdir javapath_1.7

5- cd into it and create the following links:

5-导入cd,创建以下链接:

cd javapath_1.7
mklink java.exe "C:\Program Files\Java\jre7\bin\java.exe"
mklink javaw.exe "C:\Program Files\Java\jre7\bin\javaw.exe"
mklink javaws.exe "C:\Program Files\Java\jre7\bin\javaws.exe"

6- cd out and create a directory link javapath pointing to the desired javapath. E.g.: mklink /D javapath javapath_1.7

6- cd输出并创建指向所需的javapath的目录链接。例如:mklink /D javapath javapath_1.7

7- Open the register and change the key HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion to have the value 1.7

7-打开寄存器并更改密钥HKEY_LOCAL_MACHINE\软件\JavaSoft\Java运行时环境\CurrentVersion具有1.7的值

At this point if you execute java -version you should see that you are using java version 1.7:

此时,如果您执行java版本,您应该看到您正在使用java版本1.7:

java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

8- Finally it is a good idea to create the environment variable JAVA_HOME. To do that I create a directory link named CurrentVersion in C:\Program Files\Java pointing to the Java version I'm interested in. E.g.:

8-最后,创建环境变量JAVA_HOME是一个好主意。为此我创建一个目录链接叫CurrentVersion C:\Program Files\Java指向Java版本我感兴趣。例如:

cd C:\Program Files\Java\
mklink /D CurrentVersion .\jdk1.7.0_71

9- And once this is done:

9-一旦完成:

  • Right click My Computer and select Properties.
  • 右键单击我的计算机并选择Properties。
  • On the Advanced tab, select Environment Variables, and then edit/create JAVA_HOME to point to where the JDK software is located, in that case, C:\Program Files\Java\CurrentVersion
  • 在高级选项卡上,选择环境变量,然后编辑/创建JAVA_HOME指向JDK软件所在地,在这种情况下,C:\Program Files\Java\ CurrentVersion

#3


25  

Since Java 1.6, a java.exe is installed into %windir%\system32 that supports a "-version" command line option. You can use this to select a specific version to run, e.g.:

从Java 1.6开始,Java。exe安装到%windir%\system32中,该系统支持“-version”命令行选项。你可以用它来选择要运行的特定版本,例如:

java -version:1.7 -jar [path to jar file]

will run a jar application in java 1.7, if it is installed.

如果安装了jar,将在java 1.7中运行jar应用程序。

See Oracle's documentation here: http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html

查看Oracle的文档:http://docs.oracle.com/javase/6/docs/tools/windows/java.html。

#4


6  

Once I updated my Java version to 8 as suggested by browser. However I had selected to uninstall previous Java 6 version I have been used for coding my projects. When I enter the command in "java -version" in cmd it showed 1.8 and I could not start eclipse IDE run on Java 1.6.

一旦我按照浏览器的建议将Java版本更新为8。然而,我选择卸载之前的Java 6版本,我被用于编写项目。当我在cmd中输入“java -version”命令时,它显示了1.8,我无法在java 1.6上启动eclipse IDE。

When I installed Java 8 update for the browser it had changed the "PATH" System variable appending "C:\ProgramData\Oracle\Java\javapath" to the beginning. Newly added path pointed to Java vesion 8. So I removed that path from "PATH" System variable and everything worked fine. :)

当我为浏览器安装Java 8 update时,它将“PATH”系统变量改为“C:\ProgramData\Oracle\Java\javapath”。新添加的路径指向Java vesion 8。所以我从“path”系统变量中移除这条路径,一切正常。:)

#5


4  

Go to control panel --> Java You can select the active version here

转到控制面板——> Java,您可以在这里选择活动版本

#6


3  

All you need to do is set the PATH environment variable in Windows to point to where your java6 bin directory is instead of the java7 directory.

您只需在Windows中设置PATH环境变量,使其指向java6 bin目录所在的位置,而不是java7目录。

Right click My Computer > Advanced System Settings > Advanced > Environmental Variables

右键点击我的电脑>高级系统设置>高级>环境变量

If there is a JAVA_HOME environment variable set this to point to the correct directory as well.

如果有一个JAVA_HOME环境变量,将它设置为指向正确的目录。

#7


0  

Update your environment variables

更新你的环境变量

Ensure the reference to java/bin is up to date in 'Path'; This may be automatic if you have JAVA_HOME or equivalent set. If JAVA_HOME is set, simply update it to refer to the older JRE installation.

确保“路径”中对java/bin的引用是最新的;如果您有JAVA_HOME或等效的设置,这可能是自动的。

#8


0  

If you are using windows 10 or windows server 2012, the steps to change the java runtime version is this:

如果您正在使用windows 10或windows server 2012,那么更改java运行时版本的步骤如下:

  1. Open regedit using 'Run'
  2. 打开注册表编辑器使用“运行”
  3. Navigate to HKEY_LOCAL_MACHINE -> SOFTWARE -> JavaSoft -> Java Runtime Environment
  4. 导航到HKEY_LOCAL_MACHINE ->软件-> JavaSoft -> Java运行时环境
  5. Here you will see all the versions of java you installed on your PC. For me I have several versions of java 1.8 installed, so the folder displayed here are 1.8, 1.8.0_162 and 1.8.0_171
  6. 在这里,您将看到您在PC上安装的所有java版本。对于我来说,我已经安装了几个版本的java 1.8,所以这里显示的文件夹是1.8、1.8.0_162和1.8.0_171
  7. Click the '1.8' folder, then double click the JavaHome and RuntimeLib keys, Change the version number inside to whichever Java version you want your PC to run on. For example, if the Value data of the key is 'C:\Program Files\Java\jre1.8.0_171', you can change this to 'C:\Program Files\Java\jre1.8.0_162'.
  8. 单击“1.8”文件夹,然后双击JavaHome和RuntimeLib键,将其中的版本号更改为您希望您的PC运行的任何Java版本。例如,如果键的值数据是“C:\程序文件\Java\jre1.8.0_171”,可以将其更改为“C:\程序文件\Java\jre1.8.0_162”。
  9. You can then verify the version change by typing 'java -version' on the command line.
  10. 然后,您可以通过在命令行上输入“java -version”来验证版本更改。

#1


73  

For Java applications, i.e. programs that are delivered (usually) as .jar files and started with java -jar xxx.jar or via a shortcut that does the same, the JRE that will be launched will be the first one found on the PATH.

对于Java应用程序,即以.jar文件的形式交付(通常)并以Java -jar xxx开头的程序。jar或通过同样的快捷方式,将被启动的JRE将是在路径上找到的第一个JRE。

If you installed a JRE or JDK, the likely places to find the .exes are below directories like C:\Program Files\JavaSoft\JRE\x.y.z. However, I've found some "out of the box" Windows installations to (also?) have copies of java.exe and javaw.exe in C:\winnt\system32 (NT and 2000) or C:\windows\system (Windows 95, 98). This is usually a pretty elderly version of Java: 1.3, maybe? You'll want to do java -version in a command window to check that you're not running some antiquated version of Java.

如果你安装了JRE或JDK,可能找到像C:\Program Files\JavaSoft\JRE\x.y.z. . exe低于目录但是,我已经发现一些“out of the box”Windows安装程序(也有)有java拷贝。exe和javaw。\winnt\system32 (NT和2000)或C:\windows\系统(windows95, 98)。这通常是较老版本的Java: 1.3,可能吧?您将希望在命令窗口中执行java版本,以检查您没有运行过时的java版本。

You can of course override the PATH setting or even do without it by explicitly stating the path to java.exe / javaw.exe in your command line or shortcut definition.

当然,您可以重写路径设置,甚至不用它,只需显式地声明到java的路径。exe / javaw。在命令行或快捷方式定义中的exe。


If you're running applets from the browser, or possibly also Java Web Start applications (they look like applications insofar as they have their own window, but you start them from the browser), the choice of JRE is determined by a set of registry settings:

如果您正在浏览器中运行applet,或者可能还在运行Java Web Start应用程序(它们看起来像应用程序,因为它们有自己的窗口,但是您可以从浏览器中启动它们),那么JRE的选择是由一组注册表设置决定的:

Key: HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment
Name: CurrentVersion
Value: (e.g.) 1.3

More registry keys are created using this scheme:

更多的注册表项使用此方案建立:

(e.g.) 
HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\1.3   
HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\1.3.1

i.e. one for the major and one including the minor version number. Each of these keys has values like these (examples shown):

即一个是主版本,一个包括副版本号。每一个键都有如下的值(如示例所示):

JavaHome    : C:\program Files\JavaSoft\JRE\1.3.1
RuntimeLib  : C:\Program Files\JavaSoft\JRE\1.3.1\bin\hotspot\jvm.dll
MicroVersion: 1

... and your browser will look to these settings to determine which JRE to fire up.

…您的浏览器将查看这些设置,以确定要启动哪个JRE。

Since Java versions are changing pretty frequently, there's now a "wizard" called the "Java Control Panel" for manually switching your browser's Java version. This works for IE, Firefox and probably others like Opera and Chrome as well: It's the 'Java' applet in Windows' System Settings app. You get to pick any one of the installed JREs. I believe that wizard fiddles with those registry entries.

由于Java版本的更改非常频繁,现在有一个“向导”称为“Java控制面板”,用于手动切换浏览器的Java版本。这适用于IE、Firefox,可能还适用于Opera和Chrome等:它是Windows系统设置应用中的“Java”applet。我相信巫师会摆弄那些注册表条目。

If you're like me and have "uninstalled" old Java versions by simply wiping out directories, you'll find these "ghosts" among the choices too; so make sure the JRE you choose corresponds to an intact Java installation!

如果您像我一样,通过删除目录“卸载”旧Java版本,您将在选项中找到这些“幽灵”;因此,请确保您选择的JRE符合完整的Java安装!


Some other answers are recommending setting the environment variable JAVA_HOME. This is meanwhile outdated advice. Sun came to realize, around Java 2, that this environment setting is

一些其他的答案建议设置环境变量JAVA_HOME。同时,这也是过时的建议。Sun在Java 2周围逐渐认识到,这个环境设置是

  1. unreliable, as users often set it incorrectly, and
  2. 不可靠,因为用户经常设置错误
  3. unnecessary, as it's easy enough for the runtime to find the Java library directories, knowing they're in a fixed path relative to the path from which java.exe or javaw.exe was launched.
  4. 不需要,因为运行时很容易找到Java库目录,知道它们相对于Java的路径处于固定的路径中。exe或javaw。exe。

There's hardly any modern Java software left that needs or respects the JAVA_HOME environment variable.

几乎没有任何现代Java软件需要或尊重JAVA_HOME环境变量。


More Information:

更多信息:

...and some useful information on multi-version support:

…以及一些关于多版本支持的有用信息:

#2


57  

I use to work on UNIX-like machines, but recently I have had to do some work with Java on a Windows 7 machine. I have had that problem and this is the I've solved it. It has worked right for me so I hope it can be used for whoever who may have this problem in the future.

我以前在类unix机器上工作,但最近我不得不在Windows 7机器上使用Java。我遇到过这个问题,这就是我解决的问题。它对我来说是正确的,所以我希望它可以用于任何将来有这个问题的人。

These steps are exposed considering a default Java installation on drive C. You should change what it is necessary in case your installation is not a default one.

考虑到驱动器c上的默认Java安装,这些步骤是公开的。如果您的安装不是默认安装,那么您应该更改它的必要性。

Change Java default VM on Windows 7

Suppose we have installed Java 8 but for whatever reason we want to keep with Java 7.

假设我们已经安装了Java 8,但是出于某种原因,我们希望使用Java 7。

1- Start a cmd as administrator

1-作为管理员启动cmd

2- Go to C:\ProgramData\Oracle\Java

2 -到C:\ ProgramData \甲骨文\ Java

3- Rename the current directory javapath to javapath_<version_it_refers_to>. E.g.: rename javapath javapath_1.8

3-将当前目录javapath重命名为javapath_ 。例如:重命名javapath javapath_1.8

4- Create a javapath_<version_you_want_by_default> directory. E.g.: mkdir javapath_1.7

4-创建一个javapath_ 目录。例如:mkdir javapath_1.7

5- cd into it and create the following links:

5-导入cd,创建以下链接:

cd javapath_1.7
mklink java.exe "C:\Program Files\Java\jre7\bin\java.exe"
mklink javaw.exe "C:\Program Files\Java\jre7\bin\javaw.exe"
mklink javaws.exe "C:\Program Files\Java\jre7\bin\javaws.exe"

6- cd out and create a directory link javapath pointing to the desired javapath. E.g.: mklink /D javapath javapath_1.7

6- cd输出并创建指向所需的javapath的目录链接。例如:mklink /D javapath javapath_1.7

7- Open the register and change the key HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion to have the value 1.7

7-打开寄存器并更改密钥HKEY_LOCAL_MACHINE\软件\JavaSoft\Java运行时环境\CurrentVersion具有1.7的值

At this point if you execute java -version you should see that you are using java version 1.7:

此时,如果您执行java版本,您应该看到您正在使用java版本1.7:

java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

8- Finally it is a good idea to create the environment variable JAVA_HOME. To do that I create a directory link named CurrentVersion in C:\Program Files\Java pointing to the Java version I'm interested in. E.g.:

8-最后,创建环境变量JAVA_HOME是一个好主意。为此我创建一个目录链接叫CurrentVersion C:\Program Files\Java指向Java版本我感兴趣。例如:

cd C:\Program Files\Java\
mklink /D CurrentVersion .\jdk1.7.0_71

9- And once this is done:

9-一旦完成:

  • Right click My Computer and select Properties.
  • 右键单击我的计算机并选择Properties。
  • On the Advanced tab, select Environment Variables, and then edit/create JAVA_HOME to point to where the JDK software is located, in that case, C:\Program Files\Java\CurrentVersion
  • 在高级选项卡上,选择环境变量,然后编辑/创建JAVA_HOME指向JDK软件所在地,在这种情况下,C:\Program Files\Java\ CurrentVersion

#3


25  

Since Java 1.6, a java.exe is installed into %windir%\system32 that supports a "-version" command line option. You can use this to select a specific version to run, e.g.:

从Java 1.6开始,Java。exe安装到%windir%\system32中,该系统支持“-version”命令行选项。你可以用它来选择要运行的特定版本,例如:

java -version:1.7 -jar [path to jar file]

will run a jar application in java 1.7, if it is installed.

如果安装了jar,将在java 1.7中运行jar应用程序。

See Oracle's documentation here: http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html

查看Oracle的文档:http://docs.oracle.com/javase/6/docs/tools/windows/java.html。

#4


6  

Once I updated my Java version to 8 as suggested by browser. However I had selected to uninstall previous Java 6 version I have been used for coding my projects. When I enter the command in "java -version" in cmd it showed 1.8 and I could not start eclipse IDE run on Java 1.6.

一旦我按照浏览器的建议将Java版本更新为8。然而,我选择卸载之前的Java 6版本,我被用于编写项目。当我在cmd中输入“java -version”命令时,它显示了1.8,我无法在java 1.6上启动eclipse IDE。

When I installed Java 8 update for the browser it had changed the "PATH" System variable appending "C:\ProgramData\Oracle\Java\javapath" to the beginning. Newly added path pointed to Java vesion 8. So I removed that path from "PATH" System variable and everything worked fine. :)

当我为浏览器安装Java 8 update时,它将“PATH”系统变量改为“C:\ProgramData\Oracle\Java\javapath”。新添加的路径指向Java vesion 8。所以我从“path”系统变量中移除这条路径,一切正常。:)

#5


4  

Go to control panel --> Java You can select the active version here

转到控制面板——> Java,您可以在这里选择活动版本

#6


3  

All you need to do is set the PATH environment variable in Windows to point to where your java6 bin directory is instead of the java7 directory.

您只需在Windows中设置PATH环境变量,使其指向java6 bin目录所在的位置,而不是java7目录。

Right click My Computer > Advanced System Settings > Advanced > Environmental Variables

右键点击我的电脑>高级系统设置>高级>环境变量

If there is a JAVA_HOME environment variable set this to point to the correct directory as well.

如果有一个JAVA_HOME环境变量,将它设置为指向正确的目录。

#7


0  

Update your environment variables

更新你的环境变量

Ensure the reference to java/bin is up to date in 'Path'; This may be automatic if you have JAVA_HOME or equivalent set. If JAVA_HOME is set, simply update it to refer to the older JRE installation.

确保“路径”中对java/bin的引用是最新的;如果您有JAVA_HOME或等效的设置,这可能是自动的。

#8


0  

If you are using windows 10 or windows server 2012, the steps to change the java runtime version is this:

如果您正在使用windows 10或windows server 2012,那么更改java运行时版本的步骤如下:

  1. Open regedit using 'Run'
  2. 打开注册表编辑器使用“运行”
  3. Navigate to HKEY_LOCAL_MACHINE -> SOFTWARE -> JavaSoft -> Java Runtime Environment
  4. 导航到HKEY_LOCAL_MACHINE ->软件-> JavaSoft -> Java运行时环境
  5. Here you will see all the versions of java you installed on your PC. For me I have several versions of java 1.8 installed, so the folder displayed here are 1.8, 1.8.0_162 and 1.8.0_171
  6. 在这里,您将看到您在PC上安装的所有java版本。对于我来说,我已经安装了几个版本的java 1.8,所以这里显示的文件夹是1.8、1.8.0_162和1.8.0_171
  7. Click the '1.8' folder, then double click the JavaHome and RuntimeLib keys, Change the version number inside to whichever Java version you want your PC to run on. For example, if the Value data of the key is 'C:\Program Files\Java\jre1.8.0_171', you can change this to 'C:\Program Files\Java\jre1.8.0_162'.
  8. 单击“1.8”文件夹,然后双击JavaHome和RuntimeLib键,将其中的版本号更改为您希望您的PC运行的任何Java版本。例如,如果键的值数据是“C:\程序文件\Java\jre1.8.0_171”,可以将其更改为“C:\程序文件\Java\jre1.8.0_162”。
  9. You can then verify the version change by typing 'java -version' on the command line.
  10. 然后,您可以通过在命令行上输入“java -version”来验证版本更改。