Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
674 views
in Technique[技术] by (71.8m points)

intellij idea - Could not determine Java version using executable C:Program FilesJavajdk-10.0.1injava.exe

Could not determine Java version using executable C:Program FilesJavajdk-10.0.1injava.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 FilesJavajdk-10.0.1injava.exe

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...