Scalac v javac and scala v java

So, I understand how the scalac compiler differs from javac - looking at the produced bytecodes, they did not look like javac did. class without constructor.

But is the runtime different from running java with scala java containers in the classpath? I am very sure, but someone can confirm that the scala command is just a thin shell around java - they just love JRE / JDK.

+5
source share
3 answers

The command scalais basically a script that sets the classpath and then runs your code in the Java runtime.

The corresponding line in the scalascript will appear at the end:

exec "${JAVACMD:=java}" $JAVA_OPTS -cp "$TOOL_CLASSPATH" -Dscala.home="$SCALA_HOME" -Denv.emacs="$EMACS"  scala.tools.nsc.MainGenericRunner  "$@"

java MainGenericRunner. MainGenericRunner , scala Scala. , . .

+12

Scala (on linux, anyway) is a script. The contents can be seen by typing more`which scala`

, , java.

+4

; , scala java, scala-library.jar . - scala . scala.

+1

All Articles