简体   繁体   English

提供的 javaHome 似乎无效。 我找不到 java 可执行文件。 试过位置:C:\Program Files\Java\jdk-17\bin\java.exe

[英]The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-17\bin\java.exe

I've been pulling my hair over this for 3 days now,我已经为此纠结了 3 天了,

every time I run the command react-native run-android I get this error:每次我运行命令react-native run-android我都会收到此错误:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:10284) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
Jetifier found 871 file(s) to forward-jetify. Using 16 workers...
info JS server already running.
info Installing the app...

FAILURE: Build failed with an exception.

* What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-17\bin\java.exe

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-17\bin\java.exe

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

    at makeError (C:\Users\username\Desktop\code\React Native\Build App\Scheduler\node_modules\execa\index.js:174:9)
    at C:\Users\username\Desktop\code\React Native\Build App\Scheduler\node_modules\execa\index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async runOnAllDevices (C:\Users\username\Desktop\code\React Native\Build App\Scheduler\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:106:5)
    at async Command.handleAction (C:\Users\username\Desktop\code\React Native\Build App\Scheduler\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:192:9)info Run CLI with --verbose flag for more details.

I created my directory using basic react-native init projectTesting我使用基本react-native init projectTesting创建了我的目录

My gradle is version 6.9我的gradle是6.9版本
.\android\gradle\wrapper\gradle-wrapper.properties => distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip .\android\gradle\wrapper\gradle-wrapper.properties => distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip

My android studios version is Android Studio 2020.3.1我的android studios版本是Android Studio 2020.3.1

My java version is 15我的java版本是15

C:\Users\username>java -version
java version "15" 2020-09-15
Java(TM) SE Runtime Environment (build 15+36-1562)
Java HotSpot(TM) 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)

C:\Users\username>javac -version
javac 15

I was thinking of using java 17 but in the compatibility docs it said:我正在考虑使用 java 17 但在兼容性文档中它说:

A Java version between 8 and 15 is required to execute Gradle. Java 16 and later versions are not yet supported when executing Gradle.执行Gradle需要8-15之间的Java版本,执行Gradle还不支持Java 16及以后版本。

any help would be really really appreciated!!任何帮助将不胜感激!

If someone faces this error after Android Studio update to Android Studio Electric Eel |如果有人在 Android Studio 更新到 Android Studio Electric Eel 后遇到此错误 | 2022.1.1 than simply follow following steps: 2022.1.1而不是简单地按照以下步骤操作:

Go To android studio directory (Default C:\Program Files\Android\Android Studio) remove jre folder run cmd as administrator Go 到android studio目录(默认C:\Program Files\Android\Android Studio)删除jre文件夹以管理员身份运行cmd

cd C:\Program Files\Android\Android Studio mklink /D "jre" "jbr" Thanks to this link cd C:\Program Files\Android\Android Studio mklink /D "jre" "jbr" 感谢这个链接

after update to Android Studio 22.1.1, just delete folder jre in C:\Program Files\Android\Android Studio it works for me更新到 Android Studio 22.1.1 后,只需删除 C:\Program Files\Android\Android Studio 中的文件夹 jre 它对我有用

Make sure of your JAVA_HOME Path in your terminal with确保您的终端中的 JAVA_HOME 路径

echo %JAVA_HOME%

The supplied javaHome seems to be invalid.提供的 javaHome 似乎无效。 I cannot find the java executable.我找不到 java 可执行文件。 Tried location: C:\Program Files\Java\jdk1.8.0_341\bin\java试过位置:C:\Program Files\Java\jdk1.8.0_341\bin\java

I was in a similar problem and you can solve it in the following way --> Go to Disk C, Find the java folder in android and delete the previous version of jdk by default it comes with 1.8 C:\Program Files\Java for Reac native version 11 of jdk is recommended.我遇到了类似的问题,你可以通过以下方式解决 --> Go 到磁盘 C,找到 android 中的 java 文件夹,删除之前版本的 jdk 默认自带 1.8 C:\Program Files\Java for推荐使用reac native 11版本的jdk。

If someone faces this error after Android Studio update to Android Studio Electric Eel |如果有人在Android Studio 更新到 Android Studio Electric Eel 后遇到此错误 | 2022.1.1 just delete folder jre in C:\Program Files\Android\Android Studio it works for me 2022.1.1只需删除C:\Program Files\Android\Android Studio中的文件夹jre它对我有用

Deleting Java17 SDK and C:\\Program Files\\Java folder worked for me.删除 Java17 SDK 和 C:\\Program Files\\Java 文件夹对我有用。 Use openjdk11 instead of Java17 SDK使用 openjdk11 代替 Java17 SDK

"

I faced the problem as I have multiple sdks, eg 1.8 inside my java folder along with java 11. Deleted other jdks except 11 worked for me.我遇到了这个问题,因为我有多个 sdk,例如我的 java 文件夹中的 1.8 以及 java 11。删除了其他 jdk,除了 11 对我有用。

I get help from other answers and with my tries i find this solution:我从其他答案中得到帮助,并通过尝试找到了这个解决方案:

  1. Delete jdk folder in Android Studio directory删除Android Studio目录下的jdk文件夹
  2. Change path in Windows Env.在 Windows 环境中更改路径。 Variables JAVA_HOME: .../Android Studio/jdk =>.../Android Studio/jbr变量 JAVA_HOME: .../Android Studio/jdk =>.../Android Studio/jbr
  3. Restart your IDE重启你的 IDE

after update to ANDROID STUDIO ELECTRIC EEL, just delete folder jre in (default path)C:\Program Files\Android\Android Studio.更新到 ANDROID STUDIO ELECTRIC EEL 后,只需删除(默认路径)C:\Program Files\Android\Android Studio 中的文件夹 jre。 I had my jre in D:\ANDROID_STUDIO\jre it works for me.我在 D:\ANDROID_STUDIO\jre 中有我的 jre,它对我有用。

Delete jre file in C:\Program Files\Android\Android Studio.删除C:\Program Files\Android\Android Studio中的jre文件。 Then create new jre folder and paste all contents from copy contents in C:\Program Files\Android\Android Studio\jbr.然后创建新的jre文件夹并粘贴C:\Program Files\Android\Android Studio\jbr中复制内容中的所有内容。 Works like a charm.奇迹般有效。

Make sure of your you install java 11 on your pc if You don't have installed ==> download it now from oracle.com/in/java/technologies/javase/jdk11-archive-downloads.html Make sure of your you install java 11 on your pc if You don't have installed ==> download it now from oracle.com/in/java/technologies/javase/jdk11-archive-downloads.html

==> add JAVA_HOME environment to your pc with the path of java C:\Program Files\Java\jdk-11.0.15 ==> 将 JAVA_HOME 环境添加到您的电脑,路径为 java C:\Program Files\Java\jdk-11.0.15

enter image description here在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Studio Electric Eel - 提供的 javaHome 似乎无效。 试过位置:C:\Program Files\Android\Android Studio\jre\bin\java.exe - Android Studio Electric Eel - The supplied javaHome seems to be invalid. Tried location: C:\Program Files\Android\Android Studio\jre\bin\java.exe IIntelliJ Gradle 同步失败:提供的 javaHome 似乎无效。 我找不到 java 可执行文件 - IIntelliJ Gradle sync failed: The supplied javaHome seems to be invalid. I cannot find the java executable 命令行中的 Gradle cucumber 错误 - 命令“C:\Java\jdk-17\bin\java.exe”以非零退出值 1 结束 - Gradle cucumber error in command-line - command 'C:\Java\jdk-17\bin\java.exe'' finished with non-zero exit value 1 无法使用可执行文件C:\ Program Files \ Java \ jdk-10.0.1 \ bin \ java.exe确定Java版本 - Could not determine Java version using executable C:\Program Files\Java\jdk-10.0.1\bin\java.exe Android Studio:无法使用可执行文件C:\\ Program Files \\ Java \\ jdk-10 \\ bin \\ java.exe确定Java版本 - Android Studio: Could not determine Java version using executable C:\Program Files\Java\jdk-10\bin\java.exe 指定的任务可执行位置“C:\\ Program Files(x86)\\ Java \\ jdk1.7.0_71 \\\\ bin \\ javac.exe”无效 - The specified task executable location “C:\Program Files (x86)\Java\jdk1.7.0_71\\bin\javac.exe” is invalid 开始进程'命令'C:\\Program Files\\AdoptOpenJDK\\jdk-11.0.6.10-hotspot\\bin\\java.exe'' - Getting starting process 'command 'C:\Program Files\AdoptOpenJDK\jdk-11.0.6.10-hotspot\bin\java.exe'' “system32 \ java.exe”和“Program Files \ Java \ jdk1.6.0_33 \ bin \ java.exe”有什么区别? - What is the difference between “system32\java.exe” and “Program Files\Java\jdk1.6.0_33\bin\java.exe”? 无法运行程序“C:\Program Files\Java\jdk1.8.0_202\bin\java.exe”格式错误的参数已嵌入引用:-Djava.endorsed.dirs= - Cannot run program "C:\Program Files\Java\jdk1.8.0_202\bin\java.exe" Malformed argument has embedded quote: -Djava.endorsed.dirs= Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' 以非零退出值 2 完成 - Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM