java command

The command that starts a JVM and runs a program, given a class name, a JAR file with -jar, or a single source file.

In more detail

You pass the java command a class name without the .class extension, because you are naming a class for the JVM to find, not a file. With -jar it runs the main class named in a JAR manifest, which is how the course container starts the service. Given a .java file it compiles in memory and runs it, which is the single-file source-code launcher. The -version option prints the JVM version to standard error.

Examples

java Hello
java -version
java -jar app.jar
java Hello.java

Related terms

Taught in

References

Certification courses