Introduction to Jvc
Jvc.exe is the Microsoft compiler for Java (jvc). The compiler produces interpreted (.class) files that will run on any virtual machine.
Important For last-minute changes to jvc, see Jvc Release Notes.
For an alphabetic reference to jvc options, see Reference to Jvc Command-Line Options.
For a listing of error and warning messages produced by jvc, see JVC Errors and Warning Messages.
The Jvc.exe (jvc) command line uses the following syntax:
JVC [options] <filename>
The following table describes input to the jvc command.
Entry | Meaning
|
option
| One or more jvc options. For more information, see Reference to Jvc Command-Line Options.
Note that all options apply to all specified
source files.
|
filename
| Name of one or more source files.
|
You can specify any number of options and filenames, as long
as the number of characters on the command line does not
exceed 1024 or the limit dictated by the operating system.
Note There is no guarantee that future releases of
Microsoft® Windows NT® (version 4.0 and later) and Microsoft®
Windows® 95 will have the same input limit of 1024 characters
for the command line.
Any options that you want to pass to jvc must be supplied
before the name of the .class file, or they will be
interpreted as command-line arguments to the .class file.
The jvc recognizes the following file name syntax:
- Jvc accepts files with names that follow FAT, HPFS, or
NTFS naming conventions.
- Any filename can include a full or partial path.
A full path includes a drive name and one or more directory names. Jvc accepts filenames separated either by backslashes (\) or forward slashes (/).
A partial path omits the drive name, which jvc assumes to be the current drive. If you do not specify a path, jvc assumes the file is in the current directory.
Note If a file does not have an extension, jvc assumes the
extension of .java.
You can use Jvc.exe (jvc) to compile specified .java source
files into interpreted .class files. To compile without
producing the .class files, use the /nowrite option.
You can specify jvc options on the command line.
If you are compiling your Java project from the command line,
place the options you want to supply to jvc before the name
of your .class file on the command line.
Command-line options can appear anywhere on the Jvc.exe (jvc)
command line. Jvc reads the command line from left to right,
processing command files in the order it encounters them.
Each option applies to all files on the command line. If jvc
encounters conflicting options, it uses the rightmost option.
A command file, also referred to as a response file, is a
text file that contains information you would otherwise type
on the command line. Jvc accepts a command file as an
argument on the command line. Unlike the command line, a
command file allows you to use multiple filenames.
You should use the following criteria when using command files:
- A command file can contain only filenames.
- A command file must not invoke the jvc command.
- A command file must not contain any jvc compiler options.
A command file is specified by an "at" sign (@), followed by a
filename; the filename can specify an absolute or relative path.
Use the CLASSPATH environment variable to specify additional
class path information when compiling from the command line.
The CLASSPATH environment variable has the following syntax.
SET CLASSPATH = <path>
An understanding of where the Microsoft Win32 VM for Java (Microsoft VM) and the command line get class path information will
explain why your Java program may behave differently,
depending on where it runs.
When the Microsoft VM installs, it enters the value
C:\Windows\Java\Classes\Classes.zip;.; into the registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM\Classpath. When
a Java program runs, the Microsoft VM first looks for the
CLASSPATH value in the registry. If the application executes
from the command line, the Microsoft VM also uses the
CLASSPATH environment variable, if one has been set.
What this means is if you are executing from the:
This section is an alphabetic reference to all the jvc
command-line options.
If a command-line option can take one or more arguments, its
syntax is shown before its
description. Click any option in the following table for
information on the option.
Jvc options set from the command line
/cp classpath
Use the /cp option to set the CLASSPATH environment variable
for the current compilation. Using this option specifies the
path where the jvc or jview command-line tools 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. (See CLASSPATH Environment Variable for more information.) The directories
in the class path are separated by semicolons on a Microsoft
Windows system; on UNIX, by colons.
Example:
For example, on Windows NT, the class path might be:
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, like
"class not found," when compiling from the command line.
Example:
The following example prints the class path to the screen.
JVC /cp:o
/cp:p path
This option is inserted before the path entered to the class path and
inserts a semicolon between them.
Remarks:
The value for the 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.
Example:
The following command concatenates the directories myproj1
and myproj2, and is inserted before the resulting path to the existing
class path.
JVC /cp:p myproj1 /cp:p myproj2
/d directory filename
When compiling .java files, use the /d option to specify an
output directory other than the current directory for the
.class files. If the directory does not exist, jvc will
create it.
Example:
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
/g[-] filename
Generates all debugging information. No
debugging options are set by default. The effect of using the
/g switch is the same as using the following options together.
Option | Action
|
/g:l
| Generates line number information.
|
/g:t
| Generates debug tables.
|
Remarks:
To disable this option, use a dash (-) after the
switch on the command line.
Examples:
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
/g:l[-] filename
Generates line numbers that are used when
debugging a program. By default, no debugging options are set.
Remarks:
To disable this option, use a dash (-) after the
switch on the command line.
Examples:
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 off line-number
generation:
JVC /g:l- myClass.java
/g:t[-] filename
Generates debug tables that are used when
debugging a program. By default, no debugging options are set.
Remarks:
To disable this option, use a dash (-) after the
switch on the command line.
Examples:
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 off debug-table
generation:
JVC /g:t- myClass.java
/nowrite filename
Tells jvc to compile a .java file and suppress the writing of a .class file.
Example:
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
/O filename
Combines optimizing options to produce the
fastest possible program. The effect of using this option is
the same as using the following options together.
Option | Action
|
/O:I
| Optimizes by inlining methods, when appropriate.
|
/O:J
| Optimizes bytecode jumps. Default optimization
setting.
|
Remarks:
To disable any optimization option, use a dash (-)
after the switch on the command line.
Examples:
The following command fully optimizes the code for the
myClass.class file that is produced.
JVC /O myClass.java
The following command turns off all code optimization.
JVC /O- myClass.java
/O:I filename
Tells the compiler it can inline methods to
produce more efficient code. Code that is inlined does not
have the overhead associated with a method call. Since there
is no mechanism in the Java language to request inlining of
methods, use this option when you want the compiler to inline
your code.
Remarks:
To disable this option, use a dash () after the
switch on the command line.
Examples:
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 off all inline-code optimization.
JVC /O:I- myClass.java
/O:J filename
Causes jvc to optimize 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.
Remarks:
To disable this option, use a dash (-) after the
switch on the command line.
Examples:
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 off bytecode jump optimization.
JVC /O:J- myClass.java
/verbose filename
Instructs jvc to display all messages while
compiling a file or project. These messages give useful
information about the progress of the compilation.
/w0
/w1
/w2
/w3
/w4
These options control the number of warning messages produced by the compiler. They affect only 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.
The meanings of the options are as follows:
Option | Description
|
/w0
| Turns off all warning messages.
|
/w1
| Displays severe warning messages.
|
/w2
| Displays a less-severe level of warning message
than /w1. This is the default.
|
/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.
|
/x[-] filename
This compiler supports the Java language specification. In addition, the compiler might offer a number of features
beyond those required by the Java language specification. These features
are available by default, and are not available when the /x
option is specified.
Use /x if you plan to port your program to other
environments. The /x option tells the compiler to treat
extended keywords as simple identifiers and to disable the
other Microsoft extensions.
Remarks:
To disable this option, use a dash (-) after the
switch on the command line.
Examples:
The following command ignores any extensions used
in the myClass.class file.
JVC /x myClass.java
The following command restores the default settings and
recognizes the language extensions.
JVC /x- myClass.java
/?
Displays a listing of compiler options to standard output.