Search code examples
.netscala

How to compile Scala source code into .Net


I create a scala source file test.scala:

// the source code in test.scala
import System.Console
object TestMain extends Application {
    override def main(args: Array[String]) = {
        Console.WriteLine("Hello .NET World!")
    }
}

Not that I import the System.Console which is from the .Net library.

Before compiling, I download a scala-msil package from http://www.scala-lang.org/downloads/packages/scala-msil-2.8.1.final.sbp and then install it by sbaz install -f scala-msil-2.8.1.final.sbp.

After that, some scripts, such as scalac-net.bat used to compile *.scala to *.msil, is created in %SCALA_HOME%\bin and dlls, such as microlib.dll, predef.dll and scalaruntime.dll, in %SCALA_HOME%. Unfortunately I got the error when scalac-net test.scala

enter image description here

Can anyone give me a suggestion ??

PS: My scala version is 2.8.1


Solution

  • Binaries and sources for the latest (preview) version of Scala.NET (library and compiler) can be obtained via SVN:

    svn co http://lampsvn.epfl.ch/svn-repos/scala/scala-experimental/trunk/bootstrap
    

    Bootstrapping has been an important step, and ongoing work will add support for missing features (CLR generics, etc). That's work in progress.

    A survivor's report on using Scala.NET on XNA at http://www.srtsolutions.com/tag/scala

    Miguel Garcia http://lamp.epfl.ch/~magarcia/ScalaNET/