Name
java — The Java Interpreter
Synopsis
java [interpreter-options]classname[program-arguments] java [interpreter-options] -jarjarfile[program-arguments]
Description
java
is the Java
byte-code interpreter; it runs Java programs. 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. For
example:
%java david.games.Checkers%java Test
The specified class must define a
main( ) method with exactly the following
signature:
public static void main(String[] args)
This method serves as the program entry point: the interpreter begins execution here.
In Java 1.2 and
later, a program can be packaged in an executable JAR file. To run a
program packaged in this fashion, use the -jar
option to specify the JAR file. The manifest of an executable JAR
file must contain a Main-Class attribute that
specifies which class within the JAR file contains the main(
) method at which the interpreter is to begin execution.
Any command-line options that precede the name of the class or JAR
file to execute are options to the Java interpreter itself. Any
options that follow the class name or JAR filename are options to the
program; they are ignored by the Java interpreter and passed as an
array of strings to the main() method of the
program.
The Java interpreter runs until the main( ) method exits, and any threads (except for threads marked as daemon threads) created by the program ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access