Section B.2 The Java Interpreter: java
The
java
interpreter launches a Java application. This command takes one of the following forms:java
[ options ] classname [ argument … ]java
[ options ] -jar file.jar [ argument … ]If the first form is used,
java
starts a Java runtime environment. It then loads the specified classname and runs that class’s main()
method, which must be declared as follows:public static void main(String args[])
The
String
parameter args[]
is an array of strings, which is used to pass any arguments listed on the command line. Command-line arguments are optional.If the second form of the
java
command is used, java
will load the classes and resources from the specified Java archive (JAR). In this case, the special -jar
option flag must be specified. The options can also include many other command-line options, including the -classpath
option.You have attempted of activities on this page.