How do I get the Scala version from within Scala itself?
There are three ways to get the Scala version -
scala> util.Properties.versionNumberString
res103: String = 2.11.4
scala> util.Properties.versionString
res104: String = version 2.11.4
scala> util.Properties.versionMsg
res105: String = Scala library version 2.11.4 -- Copyright 2002-2013, LAMP/EPFL
This will work without access to scala-compiler.jar
:
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.
scala> util.Properties.versionString
res0: java.lang.String = version 2.9.1.final