Last active
December 21, 2015 05:59
-
-
Save demian0311/6261368 to your computer and use it in GitHub Desktop.
Example shell script showing that Scala code really just compiles to Java and the resulting code can be run from Java if you include the scala-library.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm -f *.class | |
rm -rf *.scala | |
echo 'object HelloWorld extends App{ println("hello world")}' > hw.scala | |
echo "## Scala source created" | |
cat hw.scala | |
echo "## Compiling Scala class" | |
scalac hw.scala | |
echo "## Disassembled Java" | |
javap HelloWorld | |
echo "## Running Scala from scala" | |
scala HelloWorld | |
echo "## Running Scala from java" | |
java -cp ./scala-library.jar:. HelloWorld |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment