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

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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.



Got any Java Language Question?