c using java,无法使用可执行文件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.

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."

==================

I fixed the problem by uninstalling jdk 10 and installing jdk8

解决方案

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).

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

brew install gradle

Go to your project directory:

cd ~/path/to/your/project/

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

gradle wrapper --gradle-version 4.8

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.

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 this section of the settings select:

Select “Use gradle ‘wrapper’ task configuration”

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值