1

I am trying to compile a project containing some Java 8 source files using lambdas using SBT 0.13.7. Now, I set

-java-home /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Home

in

/usr/local/etc/sbtopts

And apparently SBT does take this into consideration, because if I supply the wrong path it complains about no java being present.

However, when I try compiling, I get the following

[error] /Users/edafinov/GitRepos/Java8SBTTest/src/main/java/Main.java:10: error: illegal start of        expression
[error]     new ArrayList<Integer>().stream().filter(i -> i%2 ==0).count();
[error]                                                 ^
[error] 1 error
[error] (compile:compile) javac returned nonzero exit code
[error] Total time: 1 s, completed Dec 26, 2014 12:28:55 PM

This seems to indicate that SBT does not use javac 1.8, but rather the 1.7 one which is the default one for my system.

What am I doing wrong?

Thank you in advance

1
  • Do you set any scalacOptions? Can you show an output of show scalacOptions?
    – lpiepiora
    Jan 1, 2015 at 13:35

1 Answer 1

2

Apparently if you have a JDK in the path, SBT would try to use that one, even when you have explicitly set the -java-home option. I solved my problem by removing the default JDK from $PATH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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