blob: 8a01845c971e0bef901db711d708c5333719a134 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001.'" t
2."
3." Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
4." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5."
6." This code is free software; you can redistribute it and/or modify it
7." under the terms of the GNU General Public License version 2 only, as
8." published by the Free Software Foundation.
9."
10." This code is distributed in the hope that it will be useful, but WITHOUT
11." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12." FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13." version 2 for more details (a copy is included in the LICENSE file that
14." accompanied this code).
15."
16." You should have received a copy of the GNU General Public License version
17." 2 along with this work; if not, write to the Free Software Foundation,
18." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19."
20." Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21." CA 95054 USA or visit www.sun.com if you need additional information or
22." have any questions.
23."
24." `
25.TH javac 1 "07 Aug 2006"
26." Generated by html2man
27
28.LP
29.SH NAME
30javac \- Java programming language compiler
31.LP
32.SH "SYNOPSIS"
33.LP
34
35.LP
36.nf
37\f3
38.fl
39\fP\f3javac\fP [ options ] [ sourcefiles ] [ @argfiles ]
40.fl
41.fi
42
43.LP
44.LP
45Arguments may be in any order.
46.LP
47.RS 3
48
49.LP
50.RS 3
51.TP 3
52options
53Command\-line options.
54.TP 3
55sourcefiles
56One or more source files to be compiled (such as MyClass.java).
57.TP 3
58@argfiles
59One or more files that lists options and source files. The \f2\-J\fP options are not allowed in these files.
60.RE
61
62.LP
63.RE
64.SH "DESCRIPTION"
65.LP
66
67.LP
68.LP
69The \f3javac\fP tool reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files.
70.LP
71.LP
72There are two ways to pass source code filenames to \f3javac\fP:
73.LP
74.RS 3
75.TP 2
76o
77For a small number of source files, simply list the file names on the command line.
78.TP 2
79o
80For 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.
81.RE
82
83.LP
84.LP
85Source 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.
86.LP
87.LP
88Inner class definitions produce additional class files. These class files have names combining the inner and outer class names, such as \f2MyClass$MyInnerClass.class\fP.
89.LP
90.LP
91You 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.
92.LP
93.LP
94By 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).
95.LP
96.SH "SEARCHING FOR TYPES"
97.LP
98
99.LP
100.LP
101When 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.
102.LP
103.LP
104For 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.
105.LP
106.LP
107When 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).
108.LP
109.LP
110If 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.
111.LP
112.LP
113You can specify different bootstrap or extension classes with the \f3\-bootclasspath\fP and \f3\-extdirs\fP options; see Cross\-Compilation Options below.
114.LP
115.LP
116A successful type search may produce a class file, a source file, or both. Here is how \f3javac\fP handles each situation:
117.LP
118.RS 3
119.TP 2
120o
121\f2Search produces a class file but no source file:\fP \f3javac\fP uses the class file.
122.TP 2
123o
124\f2Search produces a source file but no class file:\fP \f3javac\fP compiles the source file and uses the resulting class file.
125.TP 2
126o
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.
128.LP
129\f3javac\fP considers a class file out of date only if it is older than the source file.
130.RE
131
132.LP
133.LP
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.
135.LP
136.SH "OPTIONS"
137.LP
138
139.LP
140.LP
141The 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.
142.LP
143.SS
144Standard Options
145.LP
146.RS 3
147
148.LP
149.RS 3
150.TP 3
151\-classpath classpath
152Set 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.
153.LP
154If the \f3\-sourcepath\fP option is not specified, the user class path is searched for both source files and class files.
155.LP
156As 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).
157.br
158.br
159For 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.
160.TP 3
161\-Djava.ext.dirs=directories
162Override the location of installed extensions.
163.TP 3
164\-Djava.endorsed.dirs=directories
165Override the location of endorsed standards path.
166.TP 3
167\-d directory
168Set 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.
169.LP
170If \f3\-d\fP is not specified, \f3javac\fP puts the class file in the same directory as the source file.
171.LP
172\f3Note:\fP \ The directory specified by \f3\-d\fP is not automatically added to your user class path.
173.TP 3
174\-deprecation
175Show 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.
176.TP 3
177\-encoding encoding
178Set 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.
179.TP 3
180\-g
181Generate all debugging information, including local variables. By default, only line number and source file information is generated.
182.TP 3
183\-g:none
184Do not generate any debugging information.
185.TP 3
186\-g:{keyword list}
187Generate only some kinds of debugging information, specified by a comma separated list of keywords. Valid keywords are:
188.RS 3
189.TP 3
190source
191Source file debugging information
192.TP 3
193lines
194Line number debugging information
195.TP 3
196vars
197Local variable debugging information
198.RE
199.TP 3
200\-help
201Print a synopsis of standard options.
202.TP 3
203\-nowarn
204Disable warning messages. This has the same meaning as \f3\-Xlint:none\fP.
205.LP
206.TP 3
207\-source release
208Specifies the version of source code accepted. The following values for \f2release\fP are allowed:
209.RS 3
210.TP 3
2111.3
212The compiler does \f2not\fP support assertions, generics, or other language features introduced after JDK 1.3.
213.TP 3
2141.4
215The compiler accepts code containing assertions, which were introduced in JDK 1.4.
216.TP 3
2171.5
218The compiler accepts code containing generics and other language features introduced in JDK 5. This is the default.
219.TP 3
2205
221Synonym for 1.5
222.RE
223\f3Note:\fP No language changes were introduced in JDK 6, so the values \f31.6\fP and \f36\fP are not valid.
224.TP 3
225\-sourcepath sourcepath
226Specify 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.
227.LP
228\f3Note:\fP \ Classes found through the classpath are subject to automatic recompilation if their sources are found.
229.TP 3
230\-verbose
231Verbose output. This includes information about each class loaded and each source file compiled.
232.TP 3
233\-X
234Display information about non\-standard options and exit.
235.RE
236
237.LP
238.RE
239.SS
240Cross\-Compilation Options
241.LP
242.RS 3
243
244.LP
245.LP
246By 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.
247.LP
248.RS 3
249.TP 3
250\-target version
251Generate 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).
252.LP
253The default for \f3\-target\fP depends on the value of \f3\-source\fP:
254.RS 3
255.TP 2
256o
257If \-source is \f3not specified\fP, the value of \-target is \f31.6\fP
258.TP 2
259o
260If \-source is \f31.3\fP, the value of \-target is \f31.1\fP
261.TP 2
262o
263For \f3all other values\fP of \-source, the value of \-target is the value of \f3\-source\fP.
264.RE
265.TP 3
266\-bootclasspath bootclasspath
267Cross\-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.
268.TP 3
269\-extdirs directories
270Cross\-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.
271.RE
272
273.LP
274.RE
275.SS
276Non\-Standard Options
277.LP
278.RS 3
279
280.LP
281.RS 3
282.TP 3
283\-Xbootclasspath/p:path
284Prepend to the bootstrap class path.
285.TP 3
286\-Xbootclasspath/a:path
287Append to the bootstrap class path.
288.TP 3
289\-Xbootclasspath/:path
290Override location of bootstrap class files.
291.TP 3
292\-Xlint
293Enable all recommended warnings. In this release, all available warnings are recommended.
294.TP 3
295\-Xlint:none
296Disable all warnings not mandated by the Java Language Specification.
297.TP 3
298\-Xlint:\-xxx
299Disable warning \f3xxx\fP, where \f3xxx\fP is one of the warning names supported for \f3\-Xlint:xxx\fP, below
300.TP 3
301\-Xlint:unchecked
302Give more detail for unchecked conversion warnings that are mandated by the Java Language Specification.
303.TP 3
304\-Xlint:path
305Warn about nonexistent path (classpath, sourcepath, etc) directories.
306.TP 3
307\-Xlint:serial
308Warn about missing \f2serialVersionUID\fP definitions on serializable classes.
309.TP 3
310\-Xlint:finally
311Warn about \f2finally\fP clauses that cannot complete normally.
312.TP 3
313\-Xlint:fallthrough
314Check \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:
315.RS 3
316
317.LP
318.nf
319\f3
320.fl
321switch (x) {
322.fl
323case 1:
324.fl
325 System.out.println("1");
326.fl
327 // No break; statement here.
328.fl
329case 2:
330.fl
331 System.out.println("2");
332.fl
333}
334.fl
335\fP
336.fi
337.RE
338If 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.
339.TP 3
340\-Xmaxerrors number
341Set the maximum number of errors to print.
342.TP 3
343\-Xmaxwarns number
344Set the maximum number of warnings to print.
345.TP 3
346\-Xstdout filename
347Send compiler messages to the named file. By default, compiler messages go to \f2System.err\fP.
348.RE
349
350.LP
351.RE
352.SS
353The \-J Option
354.LP
355.RS 3
356
357.LP
358.RS 3
359.TP 3
360\-Joption
361Pass \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.
362.LP
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.
364.RE
365
366.LP
367.RE
368.SH "COMMAND LINE ARGUMENT FILES"
369.LP
370
371.LP
372.LP
373To 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.
374.LP
375.LP
376An 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.
377.LP
378.LP
379Filenames 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.
380.LP
381.LP
382When 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.
383.LP
384.SS
385Example \- Single Arg File
386.LP
387.LP
388You could use a single argument file named "\f2argfile\fP" to hold all javac arguments:
389.LP
390.nf
391\f3
392.fl
393 C:> \fP\f3javac @argfile\fP
394.fl
395.fi
396
397.LP
398.LP
399This argument file could contain the contents of both files shown in the next example.
400.LP
401.SS
402Example \- Two Arg Files
403.LP
404.LP
405You 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.)
406.LP
407.LP
408Create a file named "\f2options\fP" containing:
409.LP
410.nf
411\f3
412.fl
413 \-d classes
414.fl
415 \-g
416.fl
417 \-sourcepath \\java\\pubs\\ws\\1.3\\src\\share\\classes
418.fl
419\fP
420.fi
421
422.LP
423.LP
424Create a file named "\f2classes\fP" containing:
425.LP
426.nf
427\f3
428.fl
429 MyClass1.java
430.fl
431 MyClass2.java
432.fl
433 MyClass3.java
434.fl
435\fP
436.fi
437
438.LP
439.LP
440You would then run javac with:
441.LP
442.nf
443\f3
444.fl
445 % \fP\f3javac @options @classes\fP
446.fl
447.fi
448
449.LP
450.SS
451Example \- Arg Files with Paths
452.LP
453.LP
454The argument files can have paths, but any filenames inside the files are relative to the current working directory (not \f2path1\fP or \f2path2\fP):
455.LP
456.nf
457\f3
458.fl
459 % \fP\f3javac @path1/options @path2/classes\fP
460.fl
461.fi
462
463.LP
464.SH "PROGRAMMATIC INTERFACE"
465.LP
466.LP
467The \f2com.sun.tools.javac.Main\fP class provides two static methods to invoke the compiler from a program:
468.LP
469.nf
470\f3
471.fl
472public static int compile(String[] args);
473.fl
474public static int compile(String[] args, PrintWriter out);
475.fl
476\fP
477.fi
478
479.LP
480.LP
481The \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.
482.LP
483.LP
484The \f2out\fP parameter indicates where the compiler's diagnostic output is directed.
485.LP
486.LP
487The return value is equivalent to the exit value from javac.
488.LP
489.LP
490Note 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.
491.LP
492.SH "EXAMPLES"
493.LP
494.SS
495Compiling a Simple Program
496.LP
497.RS 3
498
499.LP
500.LP
501One 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.
502.LP
503.RS 3
504
505.LP
506.nf
507\f3
508.fl
509% \fP\f3ls\fP
510.fl
511greetings/
512.fl
513% \f3ls greetings\fP
514.fl
515Hello.java
516.fl
517% \f3cat greetings/Hello.java\fP
518.fl
519package greetings;
520.fl
521
522.fl
523public class Hello {
524.fl
525 public static void main(String[] args) {
526.fl
527 for (int i=0; i < args.length; i++) {
528.fl
529 System.out.println("Hello " + args[i]);
530.fl
531 }
532.fl
533 }
534.fl
535}
536.fl
537% \f3javac greetings/Hello.java\fP
538.fl
539% \f3ls greetings\fP
540.fl
541Hello.class Hello.java
542.fl
543% \f3java greetings.Hello World Universe Everyone\fP
544.fl
545Hello World
546.fl
547Hello Universe
548.fl
549Hello Everyone
550.fl
551.fi
552.RE
553
554.LP
555.RE
556.SS
557Compiling Multiple Source Files
558.LP
559.RS 3
560
561.LP
562.LP
563This example compiles all the source files in the package \f2greetings\fP.
564.LP
565.RS 3
566
567.LP
568.nf
569\f3
570.fl
571% \fP\f3ls\fP
572.fl
573greetings/
574.fl
575% \f3ls greetings\fP
576.fl
577Aloha.java GutenTag.java Hello.java Hi.java
578.fl
579% \f3javac greetings/*.java\fP
580.fl
581% \f3ls greetings\fP
582.fl
583Aloha.class GutenTag.class Hello.class Hi.class
584.fl
585Aloha.java GutenTag.java Hello.java Hi.java
586.fl
587
588.fl
589.fi
590.RE
591
592.LP
593.RE
594.SS
595Specifying a User Class Path
596.LP
597.RS 3
598
599.LP
600.LP
601Having changed one of the source files in the previous example, we recompile it:
602.LP
603.RS 3
604
605.LP
606.nf
607\f3
608.fl
609% \fP\f3pwd\fP
610.fl
611/examples
612.fl
613% \f3javac greetings/Hi.java\fP
614.fl
615.fi
616.RE
617
618.LP
619.LP
620Since \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.
621.LP
622.RS 3
623
624.LP
625.nf
626\f3
627.fl
628% \fP\f3javac \-classpath /examples /examples/greetings/Hi.java\fP
629.fl
630.fi
631.RE
632
633.LP
634.LP
635If we change \f2greetings.Hi\fP again, to use a banner utility, that utility also needs to be accessible through the user class path.
636.LP
637.RS 3
638
639.LP
640.nf
641\f3
642.fl
643% \fP\f3javac \-classpath /examples:/lib/Banners.jar \\
644.fl
645 /examples/greetings/Hi.java\fP
646.fl
647.fi
648.RE
649
650.LP
651.LP
652To execute a class in \f2greetings\fP, we need access both to \f2greetings\fP and to the classes it uses.
653.LP
654.RS 3
655
656.LP
657.nf
658\f3
659.fl
660% \fP\f3java \-classpath /examples:/lib/Banners.jar greetings.Hi\fP
661.fl
662.fi
663.RE
664
665.LP
666.RE
667.SS
668Separating Source Files and Class Files
669.LP
670.RS 3
671
672.LP
673.LP
674It 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.
675.LP
676.RS 3
677
678.LP
679.nf
680\f3
681.fl
682% \fP\f3ls\fP
683.fl
684classes/ lib/ src/
685.fl
686% \f3ls src\fP
687.fl
688farewells/
689.fl
690% \f3ls src/farewells\fP
691.fl
692Base.java GoodBye.java
693.fl
694% \f3ls lib\fP
695.fl
696Banners.jar
697.fl
698% \f3ls classes\fP
699.fl
700% \f3javac \-sourcepath src \-classpath classes:lib/Banners.jar \\
701.fl
702 src/farewells/GoodBye.java \-d classes\fP
703.fl
704% \f3ls classes\fP
705.fl
706farewells/
707.fl
708% \f3ls classes/farewells\fP
709.fl
710Base.class GoodBye.class
711.fl
712
713.fl
714.fi
715.RE
716
717.LP
718.LP
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.
720.LP
721.RE
722.SS
723Cross\-Compilation Example
724.LP
725.RS 3
726
727.LP
728.LP
729Here we use \f3javac\fP to compile code that will run on a 1.4 VM.
730.LP
731.RS 3
732
733.LP
734.nf
735\f3
736.fl
737% \fP\f3javac \-target 1.4 \-bootclasspath jdk1.4.2/lib/classes.zip \\
738.fl
739 \-extdirs "" OldCode.java\fP
740.fl
741.fi
742.RE
743
744.LP
745.LP
746The \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.
747.LP
748.LP
749The 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.
750.LP
751.RE
752.SH "SEE ALSO"
753.LP
754
755.LP
756.RS 3
757.TP 2
758o
759java \- the Java Application Launcher
760.TP 2
761o
762jdb \- Java Application Debugger
763.TP 2
764o
765javah \- C Header and Stub File Generator
766.TP 2
767o
768javap \- Class File Disassembler
769.TP 2
770o
771javadoc \- API Documentation Generator
772.TP 2
773o
774jar \- JAR Archive Tool
775.TP 2
776o
777.na
778\f2The Java Extensions Framework\fP @
779.fi
780http://java.sun.com/javase/6/docs/technotes/guides/extensions/index.html
781.RE
782
783.LP
784
785.LP
786