Scala - Compiler (scalac)

Card Puncher Data Processing


The scala compiler compiles .scala source files to .class files, like the Java compiler.



The scalac command compiles one (or more) Scala source file(s) and generates Java bytecode which can be executed on any standard JVM. The Scala compiler works similarly to javac, the Java compiler of the Java SDK.

scalac HelloWorld.scala

By default scalac generates the class files into the current working directory. You may specify a different output directory using the -d option.

scalac -d classes HelloWorld.scala

Discover More
Card Puncher Data Processing
Scala - Getting Started (Hello World)

Getting started page with an HelloWorld example and some documentation. Create a main HelloWorld object: Run it interactively: Compile it: Run the compile code: In a maven project,...
Card Puncher Data Processing
Scala - Scala Command (Execute Bytecode)

The scala command executes the generated bytecode. scala allows us to specify command options, such as the -classpath (alias -cp) option: The argument of the scala command has to be a top-level object....
Card Puncher Data Processing
Scala - Type

Every variable and expression in a Scala program has a type that is known at compile time. A type restricts the possible values to which a variable can refer, or an expression can produce, at run time....

Share this page:
Follow us:
Task Runner