What's the reason for “Error:Cannot determine Java VM executable in selected JDK”?

后端 未结 11 828
感情败类
感情败类 2021-01-31 13:04

I am using IntelliJ IDEA 13.1.4 and also tried the latest release 14.

Running SBT I get the following error:

Error:Cannot determine Java VM executable in         


        
相关标签:
11条回答
  • 2021-01-31 13:24

    You should be able to work it around by setting the jdk from the settings not from the open/import project dialog.

    From the welcome screen, go to Configure -> Project defaults -> Project structure and add the jdk.

    enter image description here

    Opening the sbt project should work well then.

    Found solution from here

    0 讨论(0)
  • 2021-01-31 13:26

    For me the above suggestions did not help for some reason. However, I did figure out that under Project Defaults > Project Structure (Welcome screen) my default Project SDK was set to the Go SDK.

    What worked for me was setting this default SDK to the Java JDK.

    0 讨论(0)
  • 2021-01-31 13:32

    IntelliJ 13.1.6 > File > Project Structure > set Project SDK

    0 讨论(0)
  • 2021-01-31 13:35

    This happened to me in a multi-language project when my primary module's Project SDK was Python and I was trying to add a secondary module that was JDK (importing an sbt project).

    I had to temporarily switch the primary module's Project SDK to JDK in order to add the sbt module. I then had the ability to go back and change each module to the correct SDK.

    0 讨论(0)
  • 2021-01-31 13:37

    The latest Nightlies of the Scala plugin change how the project JDK is set, which should solve this in most cases. Let me know if it still breaks on some cases.

    0 讨论(0)
  • 2021-01-31 13:42

    Same error also occurs when you try to do a refresh in "SBT tasks".

    Open

    Preferences -> Language & Frameworks -> Scala Compiler Server
    

    Turn on

    Run compile server (in external build mode)
    

    Once you done with refreshing the project, turn it off again to enable hotswapping back when you change your code in the editor.

    0 讨论(0)
提交回复
热议问题