How do I get the Scala version from within Scala itself?

前端 未结 4 431
面向向阳花
面向向阳花 2021-01-31 13:18

This is not about command-line compiler options. How do I programmatically obtain the Scala version inside code?

Alternatively, where does the Eclipse Scala plugin v2 st

4条回答
  •  悲&欢浪女
    2021-01-31 13:50

    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
    

提交回复
热议问题