"Java" is an interpreter that can be used to execute the byte code generated by Java compiler i.e.; it launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that class's main method. This interpreter is bundled with Java run time and Java SDK.
Syntax for the interpreter is as follows:
java [ options ] class [ argument ... ]
java [ options ] -jar file.jar [ argument ... ]
javaw [ options ] class [ argument ... ]
javaw [ options ] -jar file.jar [ argument ... ]
options: command-line options.
class: Name of the class to be invoked.
file.jar: Name of the jar file to be invoked. Used only with -jar.
argument: Argument passed to the main function.
-classpath classpath, -cp classpath: Specify a list of directories, JAR archives, and ZIP archives to search for class files. Class path entries are separated by semicolons (;). Specifying -classpath or -cp overrides any setting of the CLASSPATH environment variable.
If -classpath and -cp are not used and CLASSPATH is not set, the user class path consists of the current directory (.).
-Dproperty=value: Set a system property value. If value is a string that contains spaces, you must enclose the string in double quotes:
java -Dfoo="some string" SomeClass
-jar: Execute a program encapsulated in a JAR file. The first argument is the name of a JAR file instead of a startup class name. In order for this option to work, the manifest of the JAR file must contain a line of the form Main-Class: classname. Here, classname identifies the class having thepublic static void main(String args) method that serves as your application's starting point. See the Jar tool reference page and the Jar trail of the Java Tutorial for information about working with Jar files and Jar-file manifests.
When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.
-verbose, -verbose:class: Display information about each class loaded.
-verbose:gc: Report on each garbage collection event.
-version: Display version information and exit.
-showversion: Display version information and continue.
-X: Display information about non-standard options and exit.
-Xint: Operate in interpreted-only mode. Compilation to native code is disabled, and all bytecodes are executed by the interpreter. The performance benefits offered by the Java HotSpot Client VM's adaptive compiler will not be present in this mode.
-Xmsn: Specify the initial size, in bytes, of the memory allocation pool. This value must be a multiple of 1024 greater than 1MB. Append the letter k or Kto indicate kilobytes, or m or M to indicate megabytes. The default value is 2MB. Examples:
-Xmxn: Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k orK to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. Examples: