Java自动更新时是否更新Windows路径变量? [英] Update Windows path variable when Java is updated automatically?

查看:484
本文介绍了Java自动更新时是否更新Windows路径变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题询问如何在Windows中设置路径变量包括Java bin目录,使您可以从提示中使用javac命令.发布到此问题的解决方案指出,您应该对最新Java安装的绝对路径进行硬编码.

This question asks how to setup your path variable in Windows to include the Java bin directory allowing you to use the javac command from the prompt. The solution posted to this question states you should hard code the absolute path of the latest Java installation.

在这种情况下,它恰好是c:\program files\java\jdk1.6.0_16\bin

In this case it happens to be c:\program files\java\jdk1.6.0_16\bin

我相信,一旦安装了Java更新17、18及更高版本,您的javac cmd仍将使用此旧版本,对吗?

I believe once Java update 17, 18 and beyond are installed your javac cmd will still be using this older version, correct?

我错过了什么吗?有没有办法将其设置为自动使用最新安装的Java更新?

Am I missing something?? Is there a way to set this to automatically use the most recent installed java update??

推荐答案

我相信一旦安装了Java更新17、18及更高版本,您的javac cmd仍将使用此旧版本,对吗?

正确.更新Java时,更新的是JRE(Java运行时环境)

Correct. When java is update, what get's updated is the JRE ( java runtime environment )

这将自动将您的java插件(在浏览器中使用)设置为Java命令,并将Java命令设置为最新版本. (打开一个终端并输入java -version)

That automatically set your java plugin ( used in the browser ) and your java command set to the latest version. ( Open a terminal and type java -version )

更改了包含javac的SDK(Java SDK).您必须手动执行.

The SDK ( Java SDK ) which contains the javac is not changed. You have to do it manually.

一个选择是做mhaller所说的.

One option is do what mhaller says.

我进一步使用Windows中的环境变量.

I go further using the environment variables in Windows.

MyPC/RigthClick/Properties/Advaced/EnvironmentVariables/

MyPC/RigthClick/Properties/Advaced/EnvironmentVariables/

从那里,我将JAVA_HOME poiting添加到所需的JDK路径(c:\ jsdk_x_x_x)并将PATH变量设置为:

From there I add JAVA_HOME poiting to the desired JDK path ( c:\jsdk_x_x_x ) and set the PATH variable to:

 whatever;_it_had;_before;%JAVA_HOME%\bin

是否可以将其设置为自动使用最新安装的Java更新?

对于JRE,它将自动设置,对于SDK,您只需修改系统变量并更改JAVA_HOME的值

For the JRE it would be automatically set, for the SDK you'll only need to modify the system variables and change the value of JAVA_HOME

这篇关于Java自动更新时是否更新Windows路径变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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