Java Language The Java Command - 'java' and 'javaw'


  • java [ <opt> ... ] <class-name> [ <argument> ... ]

  • java [ <opt> ... ] -jar <jar-file-pathname> [ <argument> ... ]


The java command is used for running a Java application from the command line. It is available as a part of any Java SE JRE or JDK.

On Windows systems there are two variants of the java command:

  • The java variant launches the application in a new console window.
  • The javaw variant launches the application without creating a new console window.

On other systems (e.g. Linux, Mac OSX, UNIX) only the java command is provided, and it does not launch a new console window.

The <opt> symbol in the syntax denotes an option on the java command line. The "Java Options" and "Heap and stack sizing options" topics cover the most commonly used options. Others are covered in the JVM Flags topic.