➤ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
➤ sbt compile
[info] Loading global plugins from /Users/ogg/.sbt/0.13/plugins
java.lang.NullPointerException
at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1770)
at java.base/java.util.regex.Matcher.reset(Matcher.java:416)
at java.base/java.util.regex.Matcher.<init>(Matcher.java:253)
at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
at java.base/java.util.regex.Pattern.split(Pattern.java:1262)
at java.base/java.util.regex.Pattern.split(Pattern.java:1335)
at sbt.IO$.pathSplit(IO.scala:797)
at sbt.IO$.parseClasspath(IO.scala:912)
at sbt.compiler.CompilerArguments.extClasspath(CompilerArguments.scala:66)
at sbt.compiler.MixedAnalyzingCompiler$.withBootclasspath(MixedAnalyzingCompiler.scala:188)
at sbt.compiler.MixedAnalyzingCompiler$.searchClasspathAndLookup(MixedAnalyzingCompiler.scala:166)
at sbt.compiler.MixedAnalyzingCompiler$.apply(MixedAnalyzingCompiler.scala:176)
at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)
at sbt.Compiler$.compile(Compiler.scala:152)
at sbt.Compiler$.compile(Compiler.scala:138)
at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:860)
at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:851)
at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:849)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:830)
[error] (compile:compileIncremental) java.lang.NullPointerException
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q
➤ cat project/build.properties
sbt.version=0.13.11
NullPointerException
No NPE
Hi. Please follow the guideline on what to report - https://github.com/sbt/sbt/blob/develop/CONTRIBUTING.md#what-to-report
In particular, we need the information on how to reproduce the problem on our machines, not just what you're seeing.
Also, project/build.properties dictates the version of the core sbt artifacts for the most part (bash script being an exception), so likely what you're seeing is JDK and sbt 0.13.11 compatibility issue. Did you use Homebrew to install sbt recently? If so do you have JAVA_HOME set? java.base/java.lang.Thread in the stack trace indicates that sbt is not running on JDK 1.8. See https://github.com/Homebrew/homebrew-core/issues/50649
@eed3si9n Thanks for your answer. Yes, i've recently updated sbt with Homebrew. I didn't have JAVA_HOME env var set. Setting it fixed the problem.
Just in case someone stumbles upon this issue searching for the fix, here are the steps to fix it on MacOS Catalina (which has zsh as default shell)
JAVA_HOME point to:/usr/libexec/java_homeJAVA_HOME in the ~/.zshrc file with the output of the command at point 1 above:export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home"
- Find out what location should
JAVA_HOMEpoint to:
/usr/libexec/java_home- Set
JAVA_HOMEin the~/.zshrcfile with the output of the command at point 1 above:
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home"
Those steps can be combined into a single line in your .zshrc or .bash_profile. Assuming you want Java8:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Most helpful comment
@eed3si9n Thanks for your answer. Yes, i've recently updated
sbtwith Homebrew. I didn't haveJAVA_HOMEenv var set. Setting it fixed the problem.Just in case someone stumbles upon this issue searching for the fix, here are the steps to fix it on MacOS Catalina (which has
zshas default shell)JAVA_HOMEpoint to:/usr/libexec/java_homeJAVA_HOMEin the~/.zshrcfile with the output of the command at point 1 above:export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home"