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

后端 未结 11 829
感情败类
感情败类 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:46

    The issue is usually caused by a wrong JDK version in ".idea/sbt.xml", e.g.:

    <option name="jdk" value="1.7" />
    

    This option is not updated accordingly when the Project SDK is changed, see SCL-10085. If you have the other JDK (1.7 in my example) generally configured, no error will occur, but the Project SDK will silently be changed back. Otherwise, this error occurs.

    The problem can easily be resolved by manually editing the value in ".idea/sbt.xml" to the right JDK version.

    0 讨论(0)
  • I got the same problem after I delete Java1.6 and Java1.7 from Project Settings(with Java8 as default).

    Finally I solve the problem by change SBT JVM config to Custom Java(Settings -> Build, Execution, Deployment -> Build Tools -> SBT).

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

    For me, I had selected the JDK in "Open Module Settings" > Module > Dependencies > Module SDK. However, SBT was looking for JDK at project level which is set in "Open Module Settings" > Project > Project SDK as @michasm has pointed out above

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

    Another way to set JDK is from your current module/project settings (for your current project)

    PickOpen Module Settings from project context menu (or default hit F4),
    then from left tab select Project and point correct Project SDK on dropdown.

    enter image description here

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

    I had to open Settings -> Language & Frameworks -> Scala Compiler Server

    Then set the JVM SDK there, which was <No SDK>.

    This was in addition to setting the Project SDK in Project Structure -> Project.

    See the screenshot here.

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