How to specify which java version to use with sbt 0.12.4? I have java 7 and java 8 installed. Since sbt 0.12.4 does not support java 8 but tries to use it by default, I have to specify java version explicitly for sbt. I want to keep using java 8 as a default version of java for other things.
One way that works well for me is, using the sbt script from sbt-extras and add to the root of the project a file called .sbtopts
with:
-java-home
/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
using whatever version of Java 7 you want to use. Make sure that those are on separate.
If you're not using the sbt script from sbt-extras you could use jEnv .
After configuring jEnv, from the root of the project run jenv local 1.7
, which will create a file called .java-version
with content "1.7".
Then every time you run java
(or javac
, etc) in that project (including from any directory in that project) it will run the 1.6 version, thanks to jEnv's shim mechanisms.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.