This page is no longer maintained — Please continue to the home page at www.scala-lang.org

get the scala version at runtime

2 replies
Michael Fortin 2
Joined: 2010-08-29,
User offline. Last seen 42 years 45 weeks ago.

In java I can call System.getProperty("java.vm.version") to get the java version, is there a similar way to get the version of the scala library that would be in the classpath?

thx

Erik Engbrecht
Joined: 2008-12-19,
User offline. Last seen 3 years 18 weeks ago.
Re: get the scala version at runtime
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20).Type in expressions to have them evaluated.Type :help for more information.
scala> scala.util.Properties.versionString res0: java.lang.String = version 2.8.0.final

scala> scala.util.Properties.versionMsgres1: String = Scala library version 2.8.0.final -- Copyright 2002-2010, LAMP/EPFL

scala> scala.util.Properties.scalaPropOrElse("version.number", "unknown") res2: String = 2.8.0.final
scala> 

On Sat, Sep 4, 2010 at 1:17 PM, Michael Fortin <mikee [at] m410 [dot] us> wrote:
In java I can call System.getProperty("java.vm.version") to get the java version,  is there a similar way to get the version of the scala library that would be in the classpath?

thx



--
http://erikengbrecht.blogspot.com/
Michael Fortin 2
Joined: 2010-08-29,
User offline. Last seen 42 years 45 weeks ago.
Re: get the scala version at runtime
Thanks Erik,  that's exactly what I was looking for.  I guess I should have looked at the api a little longer, it seems obvious now. :-)
Mike
On Sep 4, 2010, at 1:23 PM, Erik Engbrecht wrote:
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20).Type in expressions to have them evaluated.Type :help for more information.
scala> scala.util.Properties.versionString res0: java.lang.String = version 2.8.0.final

scala> scala.util.Properties.versionMsgres1: String = Scala library version 2.8.0.final -- Copyright 2002-2010, LAMP/EPFL

scala> scala.util.Properties.scalaPropOrElse("version.number", "unknown") res2: String = 2.8.0.final
scala> 

On Sat, Sep 4, 2010 at 1:17 PM, Michael Fortin <mikee [at] m410 [dot] us> wrote:
In java I can call System.getProperty("java.vm.version") to get the java version,  is there a similar way to get the version of the scala library that would be in the classpath?

thx



--
http://erikengbrecht.blogspot.com/

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland