错误:未设置 JAVA_HOME 并且在您的 flutter PATH 中找不到“java"命令.扑腾 [英] ERROR: JAVA_HOME is not set and no 'java' command could be found in your flutter PATH. in flutter
问题描述
我安装了 Android Studio 4.1 并尝试运行现有项目.但它给出了这样的错误:
错误:未设置 JAVA_HOME 并且在您的 PATH 中找不到java"命令.请在您的环境中设置 JAVA_HOME 变量以匹配Java 安装的位置.
你必须设置JAVA_HOME
环境变量.
在 Windows 上,我解决了以下问题:
从
点击环境变量...".
点击新建".
填写变量名";带有JAVA_HOME"的字段.
填写变量值";带有在您的计算机上安装 Java 的路径.(对我来说,它在C:\Program Files\Java\
"下) 点击确定"并关闭所有对话框.
重新启动您的 IDE/终端.(不要跳过这一步)
I installed Android Studio 4.1 and trying to run existing project. But it gives error like this:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
You have to set the JAVA_HOME
Environment Variable.
On Windows, I solved the issue as follows:
Download the Java JDK from here and install it. (This links to version 15, which requires you to create an account in order to download. Version 16 is available to download without creating an account, but it has caused me an error that required me to downgrade.)
Set the "JAVA_HOME" Environment Variable:
Open Windows Search, type in "env", and choose "Edit the system environment variables".
Click on "Environment Variables...".
Click on "New".
Fill in the "variable name" field with "JAVA_HOME".
Fill in the "variable value" with the path to where Java is installed on your computer. (for me it was under "C:\Program Files\Java\<jdkversion>")
Click "OK" and close all dialogs.
Restart your IDE / Terminal. (do not skip this step)
这篇关于错误:未设置 JAVA_HOME 并且在您的 flutter PATH 中找不到“java"命令.扑腾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!