jdk/src/linux/doc/man/javac.1
author jjg
Tue, 11 Mar 2008 13:14:55 -0700
changeset 168 25697c18650b
parent 2 90ce3da70b43
child 2692 345bc8d65b19
permissions -rw-r--r--
6307187: clean up code for -Xlint:options Summary: introduce common code for handling one-of and any-of options Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
.'" t
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
." Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
." This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
." under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
." published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
." This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
." FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
." version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
." accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
." You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
." 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
." Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
." CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
." have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
." 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
." `
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
.TH javac 1 "07 Aug 2006"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
." Generated by html2man
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
.SH NAME
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
javac \- Java programming language compiler
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
.SH "SYNOPSIS"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
\fP\f3javac\fP [ options ] [ sourcefiles ] [ @argfiles ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
Arguments may be in any order.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
options 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
Command\-line options. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
sourcefiles 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
One or more source files to be compiled (such as MyClass.java). 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
@argfiles 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
One or more files that lists options and source files. The \f2\-J\fP options are not allowed in these files. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
.SH "DESCRIPTION"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
The \f3javac\fP tool reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
There are two ways to pass source code filenames to \f3javac\fP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
For a small number of source files, simply list the file names on the command line. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
For a large number of source files, list the file names in a file, separated by blanks or line breaks. Then use the list file name on the \f3javac\fP command line, preceded by an \f3@\fP character. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
Source code file names must have \f2.java\fP suffixes, class file names must have \f2.class\fP suffixes, and both source and class files must have root names that identify the class. For example, a class called \f2MyClass\fP would be written in a source file called \f2MyClass.java\fP and compiled into a bytecode class file called \f2MyClass.class\fP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
Inner class definitions produce additional class files. These class files have names combining the inner and outer class names, such as \f2MyClass$MyInnerClass.class\fP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
You should arrange source files in a directory tree that reflects their package tree. For example, if you keep all your source files in \f3/workspace\fP, the source code for \f2com.mysoft.mypack.MyClass\fP should be in \f3/workspace/com/mysoft/mypack/MyClass.java\fP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
By default, the compiler puts each class file in the same directory as its source file. You can specify a separate destination directory with \f3\-d\fP (see Options, below).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
.SH "SEARCHING FOR TYPES"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
When compiling a source file, the compiler often needs information about a type whose definition did not appear in the source files given on the command line. The compiler needs type information for every class or interface used, extended, or implemented in the source file. This includes classes and interfaces not explicitly mentioned in the source file but which provide information through inheritance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
For example, when you subclass \f3java.applet.Applet\fP, you are also using \f3Applet's\fP ancestor classes: \f3java.awt.Panel\fP, \f3java.awt.Container\fP, \f3java.awt.Component\fP, and \f3java.lang.Object\fP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
When the compiler needs type information, it looks for a source file or class file which defines the type. The compiler searches for class files first in the bootstrap and extension classes, then in the user class path (which by default is the current directory). The user class path is defined by setting the \f3CLASSPATH\fP environment variable or by using the \f3\-classpath\fP command line option. (For details, see Setting the Class Path).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
If you set the \-sourcepath option, the compiler searches the indicated path for source files; otherwise the compiler searches the user class path for both class files and source files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
You can specify different bootstrap or extension classes with the \f3\-bootclasspath\fP and \f3\-extdirs\fP options; see Cross\-Compilation Options below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
A successful type search may produce a class file, a source file, or both. Here is how \f3javac\fP handles each situation:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
\f2Search produces a class file but no source file:\fP \f3javac\fP uses the class file. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
\f2Search produces a source file but no class file:\fP \f3javac\fP compiles the source file and uses the resulting class file. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
\f2Search produces both a source file and a class file:\fP \f3javac\fP determines whether the class file is out of date. If the class file is out of date, \f3javac\fP recompiles the source file and uses the updated class file. Otherwise, \f3javac\fP just uses the class file. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
\f3javac\fP considers a class file out of date only if it is older than the source file.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
\f3Note:\fP \  \f3javac\fP can silently compile source files not mentioned on the command line. Use the \f3\-verbose\fP option to trace automatic compilation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
.SH "OPTIONS"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
The compiler has a set of standard options that are supported on the current development environment and will be supported in future releases. An additional set of non\-standard options are specific to the current virtual machine and compiler implementations and are subject to change in the future. Non\-standard options begin with \f3\-X\fP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
Standard Options
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
\-classpath classpath 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
Set the user class path, overriding the user class path in the \f3CLASSPATH\fP environment variable. If neither \f3CLASSPATH\fP or \f3\-classpath\fP is specified, the user class path consists of the current directory. See Setting the Class Path for more details. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
If the \f3\-sourcepath\fP option is not specified, the user class path is searched for both source files and class files.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
As a special convenience, a class path element containing a basename of \f2*\fP is considered equivalent to specifying a list of all the files in the directory with the extension \f2.jar\fP or \f2.JAR\fP (a java program cannot tell the difference between the two invocations).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
.br
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
For example, if directory \f2foo\fP contains \f2a.jar\fP and \f2b.JAR\fP, then the class path element \f2foo/*\fP is expanded to a \f2A.jar:b.JAR\fP, except that the order of jar files is unspecified. All jar files in the specified directory, even hidden ones, are included in the list. A classpath entry consisting simply of \f2*\fP expands to a list of all the jar files in the current directory. The \f2CLASSPATH\fP environment variable, where defined, will be similarly expanded. Any classpath wildcard expansion occurs before the Java virtual machine is started \-\- no Java program will ever see unexpanded wildcards except by querying the environment. For example; by invoking \f2System.getenv("CLASSPATH")\fP.   
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
\-Djava.ext.dirs=directories 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
Override the location of installed extensions. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
\-Djava.endorsed.dirs=directories 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
Override the location of endorsed standards path. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
\-d directory 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
Set the destination directory for class files. The destination directory must already exist; javac will not create the destination directory. If a class is part of a package, \f3javac\fP puts the class file in a subdirectory reflecting the package name, creating directories as needed. For example, if you specify \f3\-d /home/myclasses\fP and the class is called \f2com.mypackage.MyClass\fP, then the class file is called \f2/home/myclasses/com/mypackage/MyClass.class\fP. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
If \f3\-d\fP is not specified, \f3javac\fP puts the class file in the same directory as the source file. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
\f3Note:\fP \  The directory specified by \f3\-d\fP is not automatically added to your user class path.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
\-deprecation 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
Show a description of each use or override of a deprecated member or class. Without \f3\-deprecation\fP, \f3javac\fP shows the names of source files that use or override deprecated members or classes. \f3\-deprecation\fP is shorthand for \f3\-Xlint:deprecation\fP. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
\-encoding encoding 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
Set the source file encoding name, such as \f2EUC\-JP and UTF\-8.\fP. If \f3\-encoding\fP is not specified, the platform default converter is used. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
\-g 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
Generate all debugging information, including local variables. By default, only line number and source file information is generated. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
\-g:none 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
Do not generate any debugging information. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
\-g:{keyword list} 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
Generate only some kinds of debugging information, specified by a comma separated list of keywords. Valid keywords are: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
source 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
Source file debugging information 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
lines 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
Line number debugging information 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
vars 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
Local variable debugging information 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
\-help 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
Print a synopsis of standard options. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
\-nowarn 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
Disable warning messages. This has the same meaning as \f3\-Xlint:none\fP. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
\-source release 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
Specifies the version of source code accepted. The following values for \f2release\fP are allowed: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
1.3 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
The compiler does \f2not\fP support assertions, generics, or other language features introduced after JDK 1.3. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
1.4 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
The compiler accepts code containing assertions, which were introduced in JDK 1.4. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
1.5 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
The compiler accepts code containing generics and other language features introduced in JDK 5. This is the default. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
5 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
Synonym for 1.5 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
\f3Note:\fP No language changes were introduced in JDK 6, so the values \f31.6\fP and \f36\fP are not valid. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
\-sourcepath sourcepath 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
Specify the source code path to search for class or interface definitions. As with the user class path, source path entries are separated by colons (\f3:\fP) and can be directories, JAR archives, or ZIP archives. If packages are used, the local path name within the directory or archive must reflect the package name. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
\f3Note:\fP \  Classes found through the classpath are subject to automatic recompilation if their sources are found.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
\-verbose 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
Verbose output. This includes information about each class loaded and each source file compiled.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
\-X 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
Display information about non\-standard options and exit. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
Cross\-Compilation Options
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
By default, classes are compiled against the bootstrap and extension classes of the platform that \f3javac\fP shipped with. But \f3javac\fP also supports \f2cross\-compiling\fP, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation. It is important to use \f3\-bootclasspath\fP and \f3\-extdirs\fP when cross\-compiling; see Cross\-Compilation Example below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
\-target version 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
Generate class files that target a specified version of the VM. Class files will run on the specified target and on later versions, but not on earlier versions of the VM. Valid targets are \f31.1\fP \f31.2\fP \f31.3\fP \f31.4\fP \f31.5\fP (also \f35\fP) and \f31.6\fP (also \f36\fP). 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
The default for \f3\-target\fP depends on the value of \f3\-source\fP: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
If \-source is \f3not specified\fP, the value of \-target is \f31.6\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
If \-source is \f31.3\fP, the value of \-target is \f31.1\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
For \f3all other values\fP of \-source, the value of \-target is the value of \f3\-source\fP. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
\-bootclasspath bootclasspath 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
Cross\-compile against the specified set of boot classes. As with the user class path, boot class path entries are separated by colons (\f3:\fP) and can be directories, JAR archives, or ZIP archives. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
\-extdirs directories 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
Cross\-compile against the specified extension directories. \f2Directories\fP is a colon\-separated list of directories. Each JAR archive in the specified directories is searched for class files. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
Non\-Standard Options
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
\-Xbootclasspath/p:path 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
Prepend to the bootstrap class path. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
\-Xbootclasspath/a:path 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
Append to the bootstrap class path. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
\-Xbootclasspath/:path 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
Override location of bootstrap class files. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
\-Xlint 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
Enable all recommended warnings. In this release, all available warnings are recommended. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
\-Xlint:none 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
Disable all warnings not mandated by the Java Language Specification. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
\-Xlint:\-xxx 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
Disable warning \f3xxx\fP, where \f3xxx\fP is one of the warning names supported for \f3\-Xlint:xxx\fP, below 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
\-Xlint:unchecked 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
Give more detail for unchecked conversion warnings that are mandated by the Java Language Specification. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
\-Xlint:path 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
Warn about nonexistent path (classpath, sourcepath, etc) directories. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
\-Xlint:serial 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
Warn about missing \f2serialVersionUID\fP definitions on serializable classes. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
\-Xlint:finally 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
Warn about \f2finally\fP clauses that cannot complete normally. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
\-Xlint:fallthrough 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
Check \f2switch\fP blocks for fall\-through cases and provide a warning message for any that are found. Fall\-through cases are cases in a \f2switch\fP block, other than the last case in the block, whose code does not include a \f2break\fP statement, allowing code execution to "fall through" from that case to the next case. For example, the code following the \f2case 1\fP label in this \f2switch\fP block does not contain a \f2break\fP statement: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
switch (x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
       System.out.println("1");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
       //  No  break;  statement here.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
       System.out.println("2");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
If the \f2\-Xlint:fallthrough\fP flag were used when compiling this code, the compiler would emit a warning about "possible fall\-through into case," along with the line number of the case in question. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
\-Xmaxerrors number 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
Set the maximum number of errors to print. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
\-Xmaxwarns number 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
Set the maximum number of warnings to print. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
\-Xstdout filename 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
Send compiler messages to the named file. By default, compiler messages go to \f2System.err\fP. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
The \-J Option
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
\-Joption 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
Pass \f2option\fP to the \f3java\fP launcher called by \f3javac\fP. For example, \f3\-J\-Xms48m\fP sets the startup memory to 48 megabytes. Although it does not begin with \f3\-X\fP, it is not a `standard option' of \f3javac\fP. It is a common convention for \f3\-J\fP to pass options to the underlying VM executing applications written in Java. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
\f3Note:\fP \  \f3CLASSPATH\fP, \f3\-classpath\fP, \f3\-bootclasspath\fP, and \f3\-extdirs\fP do \f2not\fP specify the classes used to run \f3javac\fP. Fiddling with the implementation of the compiler in this way is usually pointless and always risky. If you do need to do this, use the \f3\-J\fP option to pass through options to the underlying \f3java\fP launcher.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
.SH "COMMAND LINE ARGUMENT FILES"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
To shorten or simplify the javac command line, you can specify one or more files that themselves contain arguments to the \f2javac\fP command (except \f2\-J\fP options). This enables you to create javac commands of any length on any operating system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
An argument file can include javac options and source filenames in any combination. The arguments within a file can be space\-separated or newline\-separated. If a filename contains embedded spaces, put the whole filename in double quotes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
Filenames within an argument file are relative to the current directory, not the location of the argument file. Wildcards (*) are not allowed in these lists (such as for specifying \f2*.java\fP). Use of the '\f2@\fP' character to recursively interpret files is not supported. The \f2\-J\fP options are not supported because they are passed to the launcher, which does not support argument files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
When executing javac, pass in the path and name of each argument file with the '\f2@\fP' leading character. When javac encounters an argument beginning with the character `\f2@\fP', it expands the contents of that file into the argument list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
Example \- Single Arg File
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
You could use a single argument file named "\f2argfile\fP" to hold all javac arguments:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
  C:> \fP\f3javac @argfile\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
This argument file could contain the contents of both files shown in the next example.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
Example \- Two Arg Files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
You can create two argument files \-\- one for the javac options and the other for the source filenames: (Notice the following lists have no line\-continuation characters.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
Create a file named "\f2options\fP" containing:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     \-d classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     \-g
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     \-sourcepath \\java\\pubs\\ws\\1.3\\src\\share\\classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
Create a file named "\f2classes\fP" containing:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     MyClass1.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     MyClass2.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     MyClass3.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
You would then run javac with:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
  % \fP\f3javac @options @classes\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
Example \- Arg Files with Paths
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
The argument files can have paths, but any filenames inside the files are relative to the current working directory (not \f2path1\fP or \f2path2\fP):
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
  % \fP\f3javac @path1/options @path2/classes\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
.SH "PROGRAMMATIC INTERFACE"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
The \f2com.sun.tools.javac.Main\fP class provides two static methods to invoke the compiler from a program:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
public static int compile(String[] args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
public static int compile(String[] args, PrintWriter out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
The \f2args\fP parameter represents any of the command line arguments that would normally be passed to the javac program and are outlined in the above Synopsis section.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
The \f2out\fP parameter indicates where the compiler's diagnostic output is directed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
The return value is equivalent to the exit value from javac.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
Note that all \f3other\fP classes and methods found in a package whose name starts with \f2com.sun.tools.javac\fP (informally known as sub\-packages of \f2com.sun.tools.javac\fP) are strictly internal and subject to change at any time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
.SH "EXAMPLES"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
Compiling a Simple Program
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
One source file, \f2Hello.java\fP, defines a class called \f3greetings.Hello\fP. The \f2greetings\fP directory is the package directory both for the source file and the class file and is off the current directory. This allows us to use the default user class path. It also makes it unnecessary to specify a separate destination directory with \f3\-d\fP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
% \fP\f3ls\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
greetings/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
% \f3ls greetings\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
Hello.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
% \f3cat greetings/Hello.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
package greetings;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
public class Hello {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
    public static void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
        for (int i=0; i < args.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
            System.out.println("Hello " + args[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
% \f3javac greetings/Hello.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
% \f3ls greetings\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
Hello.class   Hello.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
% \f3java greetings.Hello World Universe Everyone\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
Hello World
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
Hello Universe
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
Hello Everyone
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
Compiling Multiple Source Files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
This example compiles all the source files in the package \f2greetings\fP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
% \fP\f3ls\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
greetings/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
% \f3ls greetings\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
Aloha.java         GutenTag.java      Hello.java         Hi.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
% \f3javac greetings/*.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
% \f3ls greetings\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
Aloha.class         GutenTag.class      Hello.class         Hi.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
Aloha.java          GutenTag.java       Hello.java          Hi.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
Specifying a User Class Path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
Having changed one of the source files in the previous example, we recompile it:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
% \fP\f3pwd\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
/examples
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
% \f3javac greetings/Hi.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
Since \f2greetings.Hi\fP refers to other classes in the \f2greetings\fP package, the compiler needs to find these other classes. The example above works, because our default user class path happens to be the directory containing the package directory. But suppose we want to recompile this file and not worry about which directory we're in? Then we need to add \f2/examples\fP to the user class path. We can do this by setting \f3CLASSPATH\fP, but here we'll use the \f3\-classpath\fP option.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
% \fP\f3javac \-classpath /examples /examples/greetings/Hi.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
If we change \f2greetings.Hi\fP again, to use a banner utility, that utility also needs to be accessible through the user class path.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
% \fP\f3javac \-classpath /examples:/lib/Banners.jar \\   
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
                   /examples/greetings/Hi.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
To execute a class in \f2greetings\fP, we need access both to \f2greetings\fP and to the classes it uses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
% \fP\f3java \-classpath /examples:/lib/Banners.jar greetings.Hi\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
Separating Source Files and Class Files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
It often makes sense to keep source files and class files in separate directories, especially on large projects. We use \f3\-d\fP to indicate the separate class file destination. Since the source files are not in the user class path, we use \f3\-sourcepath\fP to help the compiler find them.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
% \fP\f3ls\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
classes/  lib/      src/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
% \f3ls src\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
farewells/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
% \f3ls src/farewells\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
Base.java      GoodBye.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
% \f3ls lib\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
Banners.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
% \f3ls classes\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
% \f3javac \-sourcepath src \-classpath classes:lib/Banners.jar \\  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
  src/farewells/GoodBye.java \-d classes\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
% \f3ls classes\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
farewells/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
% \f3ls classes/farewells\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
Base.class      GoodBye.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
\f3Note:\fP \  The compiler compiled \f2src/farewells/Base.java\fP, even though we didn't specify it on the command line. To trace automatic compiles, use the \f3\-verbose\fP option.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
Cross\-Compilation Example
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
Here we use \f3javac\fP to compile code that will run on a 1.4 VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
% \fP\f3javac \-target 1.4 \-bootclasspath jdk1.4.2/lib/classes.zip \\  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
        \-extdirs "" OldCode.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
The \f3\-target 1.4\fP option ensures that the generated class files will be compatible with 1.4 VMs. By default, \f3javac\fP compiles for JDK 6.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
The Java Platform JDK's \f3javac\fP would also by default compile against its own bootstrap classes, so we need to tell \f3javac\fP to compile against JDK 1.4 bootstrap classes instead. We do this with \f3\-bootclasspath\fP and \f3\-extdirs\fP. Failing to do this might allow compilation against a Java Platform API that would not be present on a 1.4 VM and would fail at runtime.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
.SH "SEE ALSO"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
java \- the Java Application Launcher 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
jdb \- Java Application Debugger 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
javah \- C Header and Stub File Generator 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
javap \- Class File Disassembler 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
javadoc \- API Documentation Generator 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
jar \- JAR Archive Tool 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
\f2The Java Extensions Framework\fP @
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
http://java.sun.com/javase/6/docs/technotes/guides/extensions/index.html 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786