Question

Can java run a compiled scala code?

Can command java run a compiled scala code? If so, why do we have an exclusive command scala?

 45  17074  45
1 Jan 1970

Solution

 50

You can run byte code generated by Scala if you include all necessary runtime libs for Scala (scala-library.jar, scala-swing.jar ...) in the classpath. The scala command does this automatically, and supports Scala specific command line arguments.

2010-09-02

Solution

 14

Yes, it can. Scala is compiled down to Java bytecode. But remember that it depends on the Scala runtime classes, so you need to still have Scala's jar files on the classpath.

If so, why do we have an exclusive command scala?

Convenience wrapper.

2010-09-02