scalac
Scala source code compiler
TLDR
Compile a Scala source file
SYNOPSIS
scalac [options] [source files]
DESCRIPTION
scalac is the compiler for the Scala programming language. It reads Scala source files (.scala) and compiles them into Java bytecode class files that run on the JVM.
By default, class files are placed in the same directory as their source files. Use -d to specify an alternate output directory or JAR file. The compiler integrates with Java classes via the classpath mechanism.
Options are categorized by prefix: -W for warnings, -V for verbose output, -X for extended options, and -Y for private/experimental options.
PARAMETERS
-d directory|jar
Specify where to place generated class files-classpath path
Specify where to find user class files (colon-separated on Unix)-bootclasspath path
Override location of bootstrap class files-sourcepath path
Specify where to find input source files-verbose
Output messages about what the compiler is doing-deprecation
Emit warning and location for usages of deprecated APIs-unchecked
Enable additional warnings for type erasure-Werror
Fail compilation if there are any warnings-Xlint
Enable recommended additional warnings-version
Print product version and exit-help
Print synopsis of standard options
CONFIGURATION
JAVA_HOME
Path to the JDK installation used by the Scala compiler.JAVA_OPTS
Additional JVM options passed to the compiler process (e.g., memory settings).
CAVEATS
The JAVAHOME environment variable must point to a valid JDK installation. JAVAOPTS can pass additional options to the underlying JVM. Scala 3 uses a different compiler with some incompatible options.
HISTORY
Scala was designed by Martin Odersky starting in 2001 at EPFL, with the first public release in 2004. The name stands for "scalable language." Scala 3 (Dotty) was released in 2021 with significant language improvements.
