The Java Command - 'java' and 'javaw'

Download java eBook

Syntax

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

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

Remarks

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.

Related Examples

Stats

869 Contributors: 5
Thursday, December 1, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook