Spacemacs: 0.200.7

Emacs: 25.3.1

sbt: 1.2.0

Java: openjdk version "1.8.0_171"

.sbt/1.0/plugins/plugins.sbt: addSbtPlugin("org.ensime" % "sbt-ensime" % "2.5.1")

scalaVersion 2.12.6

I have tried this with JAVA_HOME set or with using update-alternatives to specify a Java version. Initially, I had believed this was due to using an unsupported version of Java (Ensime doesn't support Java 9+) but switching to Java 8 doesn't resolve my issue.

Here's the trace:

[info] Loading settings for project global-plugins from plugins.sbt,.#plugins.sbt,idea.sbt ... [info] Loading global plugins from /home/myuser/.sbt/1.0/plugins [info] Updating ProjectRef(uri("file:/home/myuser/.sbt/1.0/plugins/"), "global-plugins")... [info] Done updating. [error] java.io.FileNotFoundException: Could not automatically find the JDK home. [error] You must explicitly set JDK_HOME or JAVA_HOME. [error] at org.ensime.EnsimePlugin$.$anonfun$JdkDir$6(EnsimePlugin.scala:694) [error] at scala.Option.getOrElse(Option.scala:121) [error] at org.ensime.EnsimePlugin$.JdkDir$lzycompute(EnsimePlugin.scala:693) [error] at org.ensime.EnsimePlugin$.JdkDir(EnsimePlugin.scala:681) [error] at org.ensime.EnsimePlugin$.$anonfun$buildSettings$20(EnsimePlugin.scala:199) [error] at scala.Option.getOrElse(Option.scala:121) [error] at org.ensime.EnsimePlugin$.$anonfun$buildSettings$19(EnsimePlugin.scala:199) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:44) [error] at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:221) [error] at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:164) [error] at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87) [error] at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:98) [error] at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94) [error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [error] at java.lang.Thread.run(Thread.java:748) [error] java.io.FileNotFoundException: Could not automatically find the JDK home. [error] You must explicitly set JDK_HOME or JAVA_HOME. [error] Use 'last' for the full log. Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?


It seems that ensime requires the src.zip file to be in the JAVA_HOME directory, the error message is misleading.

On Ubuntu 16.04 and with Java 8 you can get this by running sudo apt-get install openjdk-8-source. It's probably something similar on other OSes.

  • This is correct. I had forgotten I had posted this questions, but resolved my issue with: zypper in java-1_8_0-openjdk-devel
    – Metropolis
    Sep 9 '18 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.