1scalac(1)                        USER COMMANDS                       scalac(1)
2
3
4

NAME

6       scalac - Compiler for the Scala 2 language
7

SYNOPSIS

9       scalac  [ <options> ] <source files>
10

PARAMETERS

12       <options>
13              Command line options. See OPTIONS below.
14
15       <source files>
16              One or more source files to be compiled (such as MyClass.scala).
17

OPTIONS

19       The  compiler  has  a set of standard options that are supported on the
20       current  development  environment  and  will  be  supported  in  future
21       releases. An additional set of non-standard options are specific to the
22       current virtual machine implementation and are subject to change in the
23       future.  Non-standard options begin with -X.
24
25   Standard Options
26       -g:{none,source,line,vars,notc}
27              "none" generates no debugging info,
28
29              "source" generates only the source file attribute,
30
31              "line" generates source and line number information,
32
33              "vars" generates source, line number and local variable informa‐
34              tion,
35
36              "notc" generates all of the above and will not perform tail call
37              optimization.
38
39       -nowarn
40              Generate no warnings
41
42       -verbose
43              Output messages about what the compiler is doing
44
45       -deprecation
46              Indicate  whether  source  should  be  compiled with deprecation
47              information; defaults to off (accepted values are: on, off,  yes
48              and no)
49
50              Available since Scala version 2.2.1
51
52       -unchecked
53              Enable detailed unchecked warnings
54
55              Non variable type-arguments in type patterns are unchecked since
56              they are eliminated by erasure
57
58              Available since Scala version 2.3.0
59
60       -classpath <path>
61              Specify where to find user class files (on Unix-based systems  a
62              colon-separated list of paths, on Windows-based systems, a semi‐
63              colon-separate list of paths). This does not override the built-
64              in ("boot") search path.
65
66              The  default  class  path  is the current directory. Setting the
67              CLASSPATH variable or using the -classpath  command-line  option
68              overrides  that  default,  so if you want to include the current
69              directory in the search path, you must include "."  in  the  new
70              settings.
71
72       -sourcepath <path>
73              Specify where to find input source files.
74
75       -bootclasspath <path>
76              Override  location  of  bootstrap class files (where to find the
77              standard built-in classes, such as "scala.List").
78
79       -extdirs <dirs>
80              Override location of installed extensions.
81
82       -d <directory>
83              Specify where to place generated class files.
84
85       -encoding <encoding>
86              Specify character encoding used by source files.
87
88              The default value is platform-specific (Linux: "UTF8",  Windows:
89              "Cp1252"). Executing the following code in the Scala interpreter
90              will return the default value on your system:
91
92                  scala> new java.io.InputStreamReader(System.in).getEncoding
93
94       -target: <target>
95              Specify which backend to use (jvm-1.5,msil).
96
97              The default value is "jvm-1.5" (was "jvm-1.4" up to  Scala  ver‐
98              sion 2.6.1).
99
100       -print Print program with all Scala-specific features removed
101
102       -optimise
103              Generates  faster bytecode by applying optimisations to the pro‐
104              gram
105
106       -explaintypes
107              Explain type errors in more detail.
108
109       -uniqid
110              Print identifiers with unique names (debugging option).
111
112       -version
113              Print product version and exit.
114
115       -help  Print a synopsis of standard options.
116
117   Advanced Options
118       -Xassem <file>
119              Name of the output assembly (only relevant with -target:msil)
120
121       -Xassem-path <path>
122              List of assemblies referenced by the program (only relevant with
123              -target:msil)
124
125       -Xcheck-null
126              Emit warning on selection of nullable reference
127
128       -Xdisable-assertions
129              Generate no assertions and assumptions
130
131       -Xexperimental
132              enable experimental extensions
133
134       -Xno-uescape
135              Disable handling of \u unicode escapes
136
137       -Xplug-types
138              Parse but ignore annotations in more locations
139
140       -Xplugin: <file>
141              Load a plugin from a file
142
143       -Xplugin-disable: <plugin>
144              Disable a plugin
145
146       -Xplugin-list
147              Print a synopsis of loaded plugins
148
149       -Xplugin-opt: <plugin:opt>
150              Pass an option to a plugin
151
152       -Xplugin-require: <plugin>
153              Abort unless a plugin is available
154
155       -Xprint: <phases>
156              Print out program after <phases> (see below).
157
158       -Xprint-pos
159              Print tree positions (as offsets)
160
161       -Xprint-types
162              Print tree types (debugging option).
163
164       -Xprompt
165              Display a prompt after each error (debugging option).
166
167       -Xresident
168              Compiler stays resident, files to compile are read from standard
169              input.
170
171       -Xshow-class <class>
172              Show class info.
173
174       -Xshow-object <object>
175              Show object info.
176
177       -Xshow-phases
178              Print a synopsis of compiler phases.
179
180       -Xsource-reader <classname>
181              Specify a custom method for reading source files.
182
183       -Xscript <object>
184              Compile as a script, wrapping the code into object.main().
185
186   Compilation Phases
187       initial
188              initializing compiler
189
190       parse  parse source files
191
192       namer  create symbols
193
194       analyze
195              name and type analysis
196
197       refcheck
198              reference checking
199
200       uncurry
201              uncurry function types and applications
202
203       transmatch
204              translate match expressions
205
206       lambdalift
207              lambda lifter
208
209       typesasvalues
210              represent types as values
211
212       addaccessors
213              add accessors for constructor arguments
214
215       explicitouterclasses
216              make links from inner classes to enclosing one explicit
217
218       addconstructors
219              add explicit constructor for each class
220
221       tailcall
222              add tail-calls
223
224       wholeprog
225              perform whole program analysis
226
227       addinterfaces
228              add one interface per class
229
230       expandmixins
231              expand mixins by code copying
232
233       boxing makes boxing explicit
234
235       erasure
236              type eraser
237
238       icode  generate icode
239
240       codegen
241              enable code generation
242
243       terminal
244              compilation terminated
245
246       all    matches all phases
247

ENVIRONMENT

249       JAVACMD
250              Specify the java command to be used for running the Scala  code.
251              Arguments  may be specified as part of the environment variable;
252              spaces, quotation marks, etc., will be passed  directly  to  the
253              shell for expansion.
254
255       JAVA_HOME
256              Specify JDK/JRE home directory. This directory is used to locate
257              the java command unless JAVACMD variable set.
258
259       JAVA_OPTS
260              Specify the options to be passed to the java command defined  by
261              JAVACMD.
262
263              With  Java 1.5 (or newer) one may for example configure the mem‐
264              ory usage of the JVM  as  follows:  JAVA_OPTS="-Xmx512M  -Xms16M
265              -Xss16M"
266
267              With  GNU  Java one may configure the memory usage of the GIJ as
268              follows: JAVA_OPTS="--mx512m --ms16m"
269

EXAMPLES

271       Compile a Scala program to the current directory
272              scalac HelloWorld
273
274       Compile a Scala program to the destination directory classes
275              scalac -d classes HelloWorld.scala
276
277       Compile a Scala program using a user-defined java command
278              env  JAVACMD=/usr/local/bin/cacao   scalac   -d   classes   Hel‐
279              loWorld.scala
280
281       Compile all Scala files found in the source directory src to the desti‐
282       nation directory classes
283              scalac -d classes src/*.scala
284

EXIT STATUS

286       scalac returns a zero exist status if it succeeds to compile the speci‐
287       fied input files. Non zero is returned in case of failure.
288

AUTHOR

290       Written by Martin Odersky and other members of the Scala team.
291

REPORTING BUGS

293       Report bugs to http://lampsvn.epfl.ch/trac/scala.
294
296       This  is  open-source  software,  available  to  you  under  a BSD-like
297       license. See accomponying "copyright" or  "LICENSE"  file  for  copying
298       conditions.  There is NO warranty; not even for MERCHANTABILITY or FIT‐
299       NESS FOR A PARTICULAR PURPOSE.
300

SEE ALSO

302       fsc(1), sbaz(1), scala(1), scaladoc(1), scalap(1)
303
304
305
306version 0.4                     April 18, 2007                       scalac(1)
Impressum