无法使用可执行文件C确定Java版本:\Program Files \ Java \ _jdk-10.0.1 \ bin \ javaava.exe [英] Could not determine Java version using executable C:\Program Files\Java\jdk-10.0.1\bin\java.exe

查看:1773
本文介绍了无法使用可执行文件C确定Java版本:\Program Files \ Java \ _jdk-10.0.1 \ bin \ javaava.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法使用可执行文件C确定Java版本:\ Program Files \Java \ _jdk-10.0.1 \ bin \ javaava.exe。

Could not determine Java version using executable C:\Program Files\Java\jdk-10.0.1\bin\java.exe.

当我尝试使用Gradle在IntelliJ IDEA版本2018.1.2中创建新项目时出现此错误。它说同步失败:无法使用可执行文件C确定Java版本:\Program Files \Java \ _jdk-10.0.1 \ bin \ javaava.exe。

this error appeared when I tried to create a new project in IntelliJ IDEA Version 2018.1.2 with Gradle. It said "sync failed: Could not determine Java version using executable C:\Program Files\Java\jdk-10.0.1\bin\java.exe."

==================
我通过卸载jdk 10并安装jdk8来解决了这个问题

================== I fixed the problem by uninstalling jdk 10 and installing jdk8

推荐答案

对于JDK 10,您将需要Gradle 4.7+,默认情况下不使用IntelliJ IDEA(当前版本IntelliJ IDEA 2018.1.4)。

For JDK 10 you will need Gradle 4.7+ which is not used by default in IntelliJ IDEA (current version IntelliJ IDEA 2018.1.4).

要解决此问题,请为您的操作系统安装最新的Gradle(安装指南)。对于MacOS,您可以使用Homebrew:

To fix this issue install latest Gradle for your OS (Install guide). For MacOS you can use Homebrew:

brew install gradle

转到您的项目目录:

cd ~/path/to/your/project/

使用你安装的版本生成Gradle Wrapper脚本(在我的例子中是4.8) :

Generate Gradle Wrapper script with the version you installed (in my case it is 4.8):

gradle wrapper --gradle-version 4.8

此命令将下载Gradle 4.8,为当前项目创建脚本gradlew和gradlew.bat。从这一点开始,您应该在命令行中使用这些脚本。

This command is going to download Gradle 4.8, create scripts gradlew and gradlew.bat for your current project. From this point, you should use these scripts in the command-line.

下一步是确保IntelliJ IDEA使用这些脚本而不是内置的Gradle分发您可以通过打开IntelliJ首选项并搜索gradle(这将在构建,执行,部署/构建工具/ Gradle中)来执行此操作。

Next step, is to make sure that IntelliJ IDEA uses those, instead of built-in Gradle distribution and you can do this by opening IntelliJ preferences and search for "gradle" (this will be in "Build, Execution, Deployment / Build Tools / Gradle").

In设置的这一部分选择:

In this section of the settings select:

选择使用gradle'包装'任务配置

应用更改,按确定并重新构建(重新同步)Gradle,一切都应该没问题。我希望这会有所帮助。

Apply changes, press ok and re-build (re-sync) Gradle and everything should be fine. I hope this helps.

这篇关于无法使用可执行文件C确定Java版本:\Program Files \ Java \ _jdk-10.0.1 \ bin \ javaava.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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