Skip to main content

The java command starts a Java application. It does this by starting a Java runtime environment, loading a specified class, and calling that class's main method.

# To execute a java .class file that contains a main method by using just the class name:
java <filename>

# To execute a .jar program:
java -jar <filename.jar>

# To display the JDK, JRE and HotSpot versions:
java -version