So, I understand how the scalac compiler is different from javac – looking at the bytecodes produced, they looked nothing like what javac would produce – e.g. a class without a constructor.
But is the runtime any different than starting java with scala jars in the classpath? I am very certain but can someone confirm that the scala command is just a thin wrapper around java – after all they simply lauch a JRE / JDK.
The
scalacommand is basically a script that sets up the classpath and then runs your code in the Java Runtime environment.The relevant line in the
scalascript appears at the end:Basically, this starts
javarunningMainGenericRunner.MainGenericRunnerthen checks whether you have toldscalato run one of your Scala classes. If so, it starts running that. Otherwise, it stars up the interactive interpreter.