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
Question
Can command java
run a compiled scala code? If so, why do we have an exclusive command scala
?
Solution
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.
Solution
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.