Академический Документы
Профессиональный Документы
Культура Документы
Name
Availability
Synopsis
Description
javap disassembles the class files specified by the class names on the command line
and prints a human-readable version of those classes.
Options
-c
Print the Java Virtual Machine instructions for each of the methods in each of
the specified classes. This option disassembles all methods, including private
methods.
-classpath path
The path that javap uses to look up the classes named on the command line.
This option overrides the default path and any path specified by the
CLASSPATH environment variable. The path specified is an ordered list of
directories and ZIP files, separated by colons on UNIX systems or semicolons
on Windows systems.
-h
Prints line numbers and local variable tables in addition to the public fields of
the class. Note that line numbers and local variable information is included for
use with debuggers. Local variable information is available only if a class was
compiled with the -g option to javac; line number information is available
only if a class was compiled without the -O option.
-p
Prints private methods and variables of the specified class in addition to the
public ones. Note that some compilers (though not javac) may allow this
private field information to be "obfuscated" in such a way that private
fields and method arguments no longer have meaningful names. This makes
Java classes harder to disassemble or reverse engineer.
-s
Outputs the class member declarations using the internal Virtual Machine
format.
-v
Verbose. Outputs additional information (in the form of Java comments) about
each member of each specified class.
-verify
Causes javap to run the class verifier on the specified classes and display the
results of verification.
-version
Environment
CLASSPATH
javac
Name
javac---The Java Compiler
Availability
Synopsis
Description
javac is the Java compiler--it compiles Java source code (in .java files) into Java byte-
codes (in .class files). The Java compiler is itself written in Java.
javac may be passed any number of Java source files, whose names must all end with
the .java extension. javac produces a separate .class class file for each class defined in
the source files, regardless of how many source files there are. In other words, there
need not be a one-to-one mapping between Java source files and Java class files. Note
also that the compiler requires that there be only a single public class defined in any
one source file, and that the name of the file (minus the .java extension) be the same
as the name of the class (minus its package name, of course).
By default, javac places the class files it generates in the same directory as the
corresponding source file. You can override this behavior with the -d option.
When a source file references a class that is not defined in another source file on the
command line, javac searches for the definition of that class using the class path. The
default class path contains only the current directory and the system classes. You may
specify additional classes and packages to be searched with the -classpath option or
the CLASSPATH environment variable.
If javac compiles a source file that relies on a class that is out of date (i.e., if the
source file for that class is newer than the class file), it automatically recompiles that
file.
Options
-classpath path
The path that javac uses to look up classes referenced in the specified source
code. This option overrides the default path and any path specified by the
CLASSPATH environment variable. The path specified is an ordered list of
directories and ZIP files, separated by colons on UNIX systems or semicolons
on Windows systems.
The directory in which (or beneath which) class files should be stored. By
default, javac stores the .class files it generates in the same directory as the
.java file that those classes were defined in. If the -d flag is specified,
however, the specified directory is treated as the root of the class hierarchy
and .class files are placed in this directory, or in the appropriate subdirectory
below it, depending on the package name of the class. Thus, the following
command:
package david.games;
-depend
Tells javac to recompile any out-of-date class files it encounters, not just those
that are referenced from one of the specified source files.
-deprecation
Tells javac to issue a warning for every use of a deprecated API. By default,
javac issues only a single warning if a program uses deprecated APIs.
Available in JDK 1.1 and later.
-g
This option tells javac to add line numbers and local variable information to
the output class files, for use by debuggers. By default, javac only generates
the line numbers. With the -O option, javac does not generate even that
information.
-Jjavaoption
-nowarn
Tells javac not to print warning messages. Errors are still reported as usual.
-nowrite
Tells javac not to create any class files. Source files are parsed as usual, but no
output is written. This option is useful when you want to check that a file will
compile without actually compiling it.
-O
Enable optimization of class files. This option may cause javac to compile
static, final, and private methods inline, so that they execute faster. The
trade-off is that the class files will be larger. This option also prevents javac
from adding line number debugging information to the class files.
-verbose
Environment
CLASSPATH
java
Name
Availability
Synopsis
Description
java is the Java byte-code interpreter--it runs Java programs. java_g is a debugging
version of the interpreter. It is unoptimized, and has some additional options for
tracing the execution of a program.
The program to be run is the class specified by classname. This must be a fully
qualified name, it must include the package name of the class, but not the .class file
extension. Note that you specify the package and class name, with components
separated by '.', not the directory and filename of the class, which has its components
separated by '/' or '/'. If a Java class has no package statement, then it is not in any
package, and the class name is specified alone. Examples:
% java david.games.Checkers
% java test
See the description of the -classpath option and the CLASSPATH environment
variable below for information on specifying where java should look for classes.
The class specified by classname must contain a method main() with exactly the
following signature:
Any arguments following the classname on the java command line are placed into an
array and passed to the main() method when java starts up.
If main() creates any threads, java runs until the last thread exits. Otherwise, the
interpreter executes the body of main() and exits.
Although only a single class name is specified when invoking java, the interpreter
automatically loads any additional classes required by the program. These classes are
located relative to the Java class path, described under the -classpath option below.
By default, java runs a byte-code verifier on all classes loaded over the network. This
verifier performs a number of tests on the byte-code of the loaded class to ensure, for
example, that it does not corrupt the internal operand stack and that it performs
appropriate run-time checks on such things as array references. The -verify,
-noverify, and -verifyremote options control the byte-code verification process.
Options
-classpath path
The path that java uses to look up the specified classname and all other
classes that it loads. Specifying this option overrides the default path and the
CLASSPATH environment variable. The class path is an ordered list of
directories and ZIP files within and below which java searches for named
classes. On UNIX systems, a path is specified as a colon-separated list of
directories and ZIP files. On Windows systems, directories and ZIP files
(which may have drive specifiers that use colons) are separated from each
other with semicolons. For example, a UNIX -classpath specification might
look like this:
-classpath /usr/lib/java/classes:.:~/java/classes
A period by itself in the path indicates that the current working directory is
searched. Directories and ZIP files are searched in the order they appear. Place
the standard Java classes first in the path if you do not want them to be
accidentally or maliciously overridden by classes with the same name in other
directories.
java expects to find class files in a directory hierarchy (or with a directory
name within a ZIP file) that maps to the fully qualified name of the class.
Thus, on a UNIX system, Java would load the class java.lang.String by
looking for the file java/lang/String.class beneath one of the directories
specified in the class path. Similarly, on a Windows 95 or Windows NT
system (which support long filenames), java would look for the file
java\lang\String.class beneath a specified directory or within a specified ZIP
file.
-cs, -checksource
Both of these options tell java to check the modification times on the specified
class file and its corresponding source file. If the class file cannot be found or
if it is out of date, it is automatically recompiled from the source.
-Dpropertyname=value
Defines propertyname to equal value in the system properties list. Your Java
program can then look up the specified value by its property name. You may
specify any number of -D options. For example:
Causes java to display a password as it starts up. This password can be used to
allow the jdb debugger to attach itself to this interpreter session. Note that this
password should not be considered cryptographically secure.
-help
-ldigit
Specifies how much memory is allocated for the heap when the interpreter
starts up. By default, initmem is specified in bytes. You can specify it in
kilobytes by appending the letter k or in megabytes by appending the letter m.
The default is 1 MB. For large or memory intensive applications (such as the
Java compiler), you can improve run-time performance by starting the
interpreter with a larger amount of memory. You must specify an initial heap
size of at least 1000 bytes.
-mx maxmem[k|m]
Specifies the maximum heap size the interpreter will use for dynamically
allocated objects and arrays. maxmem is specified in bytes by default. You can
specify maxmem in kilobytes by appending the letter k and in megabytes by
appending the letter m. The default is 16 MB. You must not specify a heap size
less than 1000 bytes.
-noasyncgc
-noclassgc
Do not garbage collect loaded classes that are no longer in use. This option is
only available in JDK 1.1 and later.
-noverify
-oss stacksize[k|m]
Sets the size of each thread's Java code stack. By default, stacksize is
specified in bytes. You can specify it in kilobytes by appending the letter k or
in megabytes by appending the letter m. The default value is 400 KB. You
must specify at least 1000 bytes.
-prof[:file]
-ss stacksize[k|m]
Sets the size of each thread's native code stack. By default, stacksize is
specified in bytes. You can specify it in kilobytes by appending the letter k or
in megabytes by appending the letter m. The default value is 128 KB. You
must specify at least 1000 bytes.
-t
-tm
-v, -verbose
-verbosegc
-verify
-verifyremote
Run the byte-code verifier on all classes that are loaded through a class loader.
(This generally means classes that are dynamically loaded from an untrusted
location.) This is the default behavior for java.
-version
Environment
CLASSPATH