Skip to content

Instantly share code, notes, and snippets.

@demian0311
Last active December 21, 2015 05:59
Show Gist options
  • Save demian0311/6261368 to your computer and use it in GitHub Desktop.
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.
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