This section describes the command-line options that can be used with jvc.
Sets the CLASSPATH environment variable for the current compilation. This option specifies the path where jvc can find system and user-defined classes. The Java interpreter uses a platform-dependent default location and the CLASSPATH environment variable to find system classes. The directories in the class path are separated by semicolons on a Microsoft® Windows® system; on UNIX, by colons.
For example, on Windows NT, the class path might be as follows:
jvc /cp x:.;x:\java\classes
In this example, jvc searches in and beneath the directories on the path for system- and user-defined classes.
Prints the class path to standard output. This option is especially useful for troubleshooting errors, such as Class not Found, when compiling from the command line.
The following example prints the class path to the screen:
jvc /cp:o
Prepends the path entered to the beginning of the existing class path and inserts a semicolon (;) between them.
The value for the existing class path can come from the CLASSPATH environment variable or from the /cp option. When multiple /cp:p switches are entered, the paths are concatenated.
For example, the following command concatenates the directories myproj1 and myproj2, and inserts the resulting path before the existing class path:
jvc /cp:p myproj1 /cp:p myproj2
Defines a conditional compilation symbol.
Specifies an output directory other than the current directory for the .class files. If the directory does not exist, jvc will create it.
The following command compiles the myClass.java file into a myClass.class file and writes this file into the class directory:
jvc /d c:\classdir myClass.java
Generates all debugging information. No debugging options are set by default. The effect of using the /g switch is the same as using the /g:l (generates line numbers) and /g:t (generates debug tables) options together.
To disable this option, use a hyphen (-) after the switch on the command line.
The following command creates a .class file called myClass.class that contains debugging information:
jvc /g myClass.java
The following command instructs jvc to exclude debugging information from the myClass.class file:
jvc /g- myClass.java
Generates line numbers that are used when debugging a program. By default, no debugging options are set.
To disable this option, use a hyphen (-) after the switch on the command line.
The following command instructs jvc to generate line-number information for the resulting myClass.class file:
jvc /g:l myClass.java
The following command instructs jvc to turn line-number generation off:
jvc /g:l- myClass.java
Generates debug tables that are used when debugging a program. By default, no debugging options are set.
To disable this option, use a hyphen (-) after the switch on the command line.
The following command instructs jvc to generate debug-table information for the resulting myClass.class file:
jvc /g:t myClass.java
The following command instructs jvc to turn debug-table generation off:
jvc /g:t- myClass.java
Suppresses the display of the Microsoft copyright message.
Turns off warnings. By default, warnings are enabled.
Compiles a .java file without writing a .class file.
In the following example, the myClass.java file is compiled and errors and warnings are reported, but no myClass.class file is produced:
jvc /nowrite myClass.java
Full optimization; combines optimizing options to produce the fastest possible program. The effect of using this option is the same as using the /O:I (optimizes by inlining methods) and /O:J (optimizes bytecode jumps) options together.
To disable any optimization option, use a hyphen (-) after the switch on the command line.
The following command fully optimizes the code for the myClass.class file that is produced:
jvc /O myClass.java
The following command turns all code optimization off:
jvc /O- myClass.java
Optimizes by inlining methods. Code that is inlined does not have the overhead associated with a method call. Because Java has no mechanism to request method inlining, use this option when you want the compiler to inline your code.
To disable this option, use a hyphen (–) after the switch on the command line.
The following example evaluates the source code in the myClass.java file and inlines methods where possible. The resulting myClass.class file contains the optimized code:
jvc /O:I myClass.java
The following command turns all inline-code optimization off:
jvc /O:I- myClass.java
Optimizes the bytecode jumps in the compiled .class file. This switch tells the compiler to generate code that jumps to another jump. This switch is the compiler's default optimization setting.
To disable this option, use a hyphen (-) after the switch on the command line.
The following example evaluates the source code in the myClass.java file and optimizes the bytecode jumps to produce more efficient code. The resulting myClass.class file contains the optimized code.
jvc /O:J myClass.java
The following command turns bytecode jump optimization off:
jvc /O:J- myClass.java
Recompiles referenced classes if they are out-of-date. This option is enabled by default. To disable this option, use a hyphen (-) after the switch on the command line.
Displays all messages while compiling a file or project. These messages give useful information about the progress of the compilation.
Specifies the number of warning messages produced by the compiler; this only applies to source files named on the command line.
Compiler warning message numbers begin with J5. The documentation describes the warnings, indicates each warning's level, and indicates potential problems (rather than actual coding errors) with statements that might not compile as you intend. See Jvc Errors and Warning Messages for a complete list of the warning messages produced by jvc.
The meanings of the /w options are shown in the following table.
/w0 | Turns all warning messages off. |
/w1 | Displays severe warning messages. |
/w2 | Displays a less-severe level of warning message than /w1 ; the default option. |
/w3 | Displays a less-severe level of warning message than /w2, including use of methods with no declared return type, failure to put return statements in methods with non-void return types, and data conversions that would cause loss of data or precision. |
/w4 | Displays the least severe level of warning messages. |
Treats warnings as errors.
Treats extended keywords as simple identifiers and disables all other Microsoft extensions. The /x option is enabled by default and should be used if you plan to port your program to other environments.
Jvc supports the Java language specification. The compiler also offer a number of features beyond those required by the Java language specification. These features are not available when the /x option is used. To enable these extensions, use a hyphen (-) after the switch on the command line.
The following command ignores any extensions used in the myClass.class file:
jvc /x myClass.java
The following command enables the language extensions:
jvc /x- myClass.java
Displays jvc usage information including a list of command-line options.