Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which version of Java does SBT use?

Tags:

scala

sbt

People also ask

Can sbt be used for Java?

sbt (Simple Build Tool), usually pronounced as es-bee-tee, is a build tool for Scala projects. I found it is also useful to build pure-java projects, but Java programmers are not generally familiar with sbt and Scala.

What is my sbt version?

Running the command, "sbt sbt-version" will simply output your current directory and the version number.

Which version of Scala does sbt use?

sbt 0.13 uses Scala 2.10.

Why is Scala compatible with Java?

Since Scala was built for the JVM platform, its source code is designed to be compiled into Java bytecode so that the code generated can run efficiently on the JVM. The name Scala is a blend of the words “scalable” and “language,” meaning that it can scale according to users' growing demands.


You can use eval at the sbt prompt with the appropriate system properties:

> eval System.getProperty("java.version")
[info] ans: String = 1.7.0_45
> eval System.getProperty("java.home")
[info] ans: String = /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre

(The other answers are fine too, this is just another method.)


Just run sbt console and you'll get something like this:

Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_45). Type in expressions to have them evaluated. Type :help for more information.

Which shows you the version of Java being used.

Cheers

JC


It's actually easy.

Find the command line of SBT (cat `which sbt`) and see which Java it is.

For example, my SBT command line begins with:

/usr/bin/java -Xmx512M

And /usr/bin/java -version tells the Java version, in my case it is 1.7.


sbt -v is another way:

# sbt -v
[process_args] java_version = '1.7.0_121'
# Executing command line:
java
-Xms1024m
-Xmx1024m
-XX:ReservedCodeCacheSize=128m
-XX:MaxPermSize=256m
-jar
/usr/share/sbt-launcher-packaging/bin/sbt-launch.jar

[info] Loading project definition from /root/.sbt/0.13/staging/a6d8e5030b69785a9763/build/project
[info] Set current project to xx (in build file:/build/)
>