Javac options for Win32 Flash Cards
Title: Javac options for Win32
Description: compiler arguments for 1.1.3
Number of Cards: 19
Save Count: 0
Author: support21
Created: 2001-05-10
Tags: java
Private No
Facebook:

Save Count represents the number of people who have saved this card set to their flashcard list. Consider this an endorsement!

Question Answer Side 3
-g Generate all debugging information, including local variables. By default, only line number and source file information is generated.

-target version Generate class files that will work on VMs with the specified version. The default is to generate class files to be compatible with both 1.1 VMs and VMs of the Java 2 SDK. The versions supported by javac in the Java 2 SDK are:

1.1

Ensure that generated class files will be compatible with 1.1 and VMs in the Java 2 SDK. This is the default.

1.2

Generate class files that will run on VMs in the Java 2 SDK, v 1.2 and later, but will not run on 1.1 VMs.

1.3

Generate class files that will run on VMs in the Java 2 SDK, v 1.3 and later, but will not run on 1.1 or 1.2 VMs.

-nowarn Disable warning messages.

-g:none Do not generate any debugging information.

-sourcepath sourcepath Specify the source code path to search for class or interface definitions. As with the user class path, source path entries are separated by semicolons (;) 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.

Note that classes found through the classpath are subject to automatic recompilation if their sources are found.

-g:{keyword list} Generate only some kinds of debugging information, specified by a comma separated list of keywords. Valid keywords are:

source

Source file debugging information

lines

Line number debugging information

vars

Local variable debugging information

-verbose Verbose output. This includes information about each class loaded and each source file compiled.

Cross-Compilation Options

By default, classes are compiled against the bootstrap and extension classes of the JDK that javac shipped with. But javac also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation. It is important to use -bootclasspath and -extdirs when cross-compiling; see Cross-Compilation Example below.

-Xverbosepath Describe how paths and standard extensions were searched to find source and class files.

The -J option

Both javac and oldjavac support the -J option.

-O Note: the -O option does nothing in the current implementation of javac and oldjavac.

Optimize code for execution time. Using the -O option may slow down compilation, produce larger class files, and make the program difficult to debug.

Prior to the Java 2 SDK, the -g and -O options of javac could not be used togther. As of the Java 2 SDK, v1.2, you can combine -g and -O, but you may get suprising results, such as missing variables or relocated or missing code. -O no longer automatically turns on -depend or turns off -g.

-Joption Pass option to the java launcher called by javac. For example, -J-Xms48m sets the startup memory to 48 megabytes. Although it does not begin with -X, it is not a standard option of javac. It is a common convention for -J to pass options to the underlying VM executing applications written in Java.

Note that CLASSPATH, -classpath, -bootclasspath, and -extdirs do not specify the classes used to run javac. 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 -J option to pass through options to the underlying java launcher.

-Xstdout Send compiler messages to System.out. By default, compiler messages go to System.err.

-X Display information about non-standard options and exit.

-Xdepend Recursively search all reachable classes for more recent source files to recompile. This option will more reliably discover classes that need to be recompiled, but can slow down the compilation process drastically.

-encoding Set the source file encoding name, such as EUCJIS/SJIS. If -encoding is not specified, the platform default converter is used.

-bootclasspath bootclasspath Cross-compile against the specified set of boot classes. As with the user class path, boot class path entries are separated by semicolons (;) and can be directories, JAR archives, or ZIP archives.

-extdirs directories Cross-compile against the specified extension directories. Directories is a semicolon-separated list of directories. Each JAR archive in the specified directories is searched for class files.

Non-Standard Options

These options are supported only by oldjavac. They are not supported by the new javac compiler.

-classpath classpath Set the user class path, overriding the user class path in the CLASSPATH environment variable. If neither CLASSPATH or -classpath is specified, the user class path consists of the current directory. See Setting the Class Path for more details.

If the -sourcepath option is not specified, the user class path is searched for source files as well as class files.

-d directory Set the destination directory for class files. If a class is part of a package, javac puts the class file in a subdirectory reflecting the package name, creating directories as needed. For example, if you specify -d c:myclasses and the class is called com.mypackage.MyClass, then the class file is called c:myclassescommypackageMyClass.class.

If -d is not specified, javac puts the class file in the same directory as the source file.

Note that the directory specified by -d is not automatically added to your user class path.

-deprecation Show a description of each use or override of a deprecated member or class. Without -deprecation, javac shows the names of source files that use or override deprecated members or classes.

 
Copyright © 2001-2012 Collective Research