The java tool executes a Java class.
To execute a Java class, the java tool loads the bytecode of the specified class and invokes the main() method of the class.
You can also use the java tool to run executable JAR files.
The syntax to use the java tool to execute a Java class is:
java [options]
options refers to the command line options that you can pass to the java tool.
The class-name specifies the name of the class file to execute.
OptionDescription
-clientSelects the Java HotSpot Client Virtual Machine (VM) to use for executing a class.
-serverSelects the Java HotSpot Server VM to use for executing a class.
-cp classpathSpecifies a list of directories, JAR archives, and ZIP archives to search class files.
-jarExecutes a JAR file.
-versionDisplays the JVM version.