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