如何在Windows上设置Java路径? [英] How to Set Java Path On Windows?

查看:61
本文介绍了如何在Windows上设置Java路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置环境路径后,它不能在Java,Eclipse和Android Studio中正常工作吗?
如何正确设置?

When we set the environment path, can't it work correctly for Java, Eclipse and Android Studio?
How to set it correctly?

当我使用命令提示符临时设置它时,设置路径无法正常工作.
因此,我尝试使用环境变量Path对其进行永久设置,但这是不可能的.

When I set it temporarily by using the command prompt, set path is not working correctly.
So I tried to set it permanently by using the environment variable Path, but it's not possible.

如何正确设置?
请给我详细的解释

How can I set it properly?
Please give me a detailed explanation

推荐答案

除了设置 JAVA_HOME 系统变量外,您还需要设置 Path 变量,因为 Path 是操作系统用于从终端窗口中找到所需可执行文件的系统变量.

Apart from setting the JAVA_HOME system variable you need to set the Path variable as well because the Path is the system variable that your Operating system uses to locate the needed executable from the terminal window.

因此,设置路径变量的步骤如下:

So for setting the Path Variable proceed as follows:

  • 右键单击我的电脑"图标->属性->高级系统设置->环境变量
  • 现在,在系统变量下滚动到 Path 变量
  • 选择路径"变量,然后单击编辑"按钮
  • 现在在Variable值的末尾添加%JAVA_HOME%\ bin,将此值与列表中的现有值分隔开;例如xxxxx;%JAVA_HOME%\ bin;

请注意,在执行上述步骤之前,还请检查是否正确设置了JAVA_HOME变量.为此,请转到命令提示符并键入 echo%JAVA_HOME%.如果设置正确,它将为您提供jdk的路径.

Note that before following the above steps also check if your JAVA_HOME variable is properly set. For doing this go to command prompt and type echo %JAVA_HOME%. If it is properly set then it will give you the path of your jdk.

注意: :有时会同时设置 Path JAVA_HOME 变量,但仍然存在不起作用.为避免这种情况,请以管理员身份运行命令提示符.

NOTE: Sometimes it happens that both the Path and JAVA_HOME variables are set properly but still things are not working.To avoid this run the command prompt as administrator.

这篇关于如何在Windows上设置Java路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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