java Command
The java
command runs a Java program from a command prompt. The basic syntax is
java filename [options]
When you run the java
command, the JRE is loaded along with the class you specify. Then, the main method of that class is executed.
Here’s an example that runs a program named HelloApp
:
C:\java\samples>
java HelloApp
The Java runtime command lets you specify options that can influence its behavior.
Option |
Description |
|
Lists standard options |
|
Lists the directories or JAR or Zip archive files used to search for class files |
|
Runs the client virtual machine |
|
Does the same thing as |
|
Sets a system property |
|
Disables system assertions |
|
Enables assertions for the specified classes or packages |
|
Enables the |
|
Get Java For Dummies Quick Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.