SBT gives java.lang.NullPointerException when trying to run a simple "Hello!" script example

I first tried my hand in Scala, and I decided to do this using SBT 0.13.9 on a Linux machine that has a new installation of Ubuntu 14.04LTS installed.

I follow the instructions on the SBT website and now I am trying to run "Hello!". An example script that looks like this:

object Hi { def main(args: Array[String]) = println("Hi!") } 

When I try to run, I get the following output:

 [trace] Stack trace suppressed: run last compile:compileIncremental for the full output. [error] (compile:compileIncremental) java.lang.NullPointerException [error] Total time: 1 s, completed 22 Aug 2015, 2:30:09 PM 

Being completely new to Scala and SBT (as well as relatively new to Linux), I'm sure I just forgot something obvious. No amount of Googling has given any answers yet.

What should I check first? I would really appreciate any advice anyone can offer.

+4
source share
1 answer

I had the same error on the same code snippet! those. first at the beginning of scala sbt hello.html

My problem was solved when I uninstalled java 9 sdk and installed java 8 sdk.

This required that I also have to reinstall scala and sbt.

I installed with the instructions HERE , but replacing the version numbers in the scala -2.11.7.deb and sbt -0.13.9.deb commands (my dev machine is on ubuntu 14.04)

+5
source