Launching Hello.java - My First Java Program
<< 'java' - The Java Program Launcher
<< Java Tool Tutorials - Herong's Tutorial Notes
This section provides a tutorial example on how to launch a simple java program using the 'java' tool without any options.
To test the Java launcher, 'java', I wrote the following Java file, Hello.java:
class Hello { public static void main(String[] a) { System.out.println("Hello world!"); } }
Here is what I did in a command window to compile Hello.java into Hello.class:
C:\herong>javac Hello.java C:\herong>dir Hello.* 416 Hello.class 116 Hello.java C:\herong>java Hello Hello world!
As you can see, launching a simple Java application is easy - Run the 'java' command without any options.
Sections in This Chapter
'java' - Java Launching Command and Options
Option "-classpath" - Specifying Class Path
Option '-jar' - Specifying Executable JAR Files
Option '-X' - Specifying Non-Standard Options
'javaw' - Launching Java Programs without Console