Launching Hello.java - My First Java Program

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.

Last update: 2015.

Table of Contents

 About This Book

 Java Tools Terminology

 Installing Java 8 on Windows

 'javac' - The Java Program Compiler

'java' - The Java Program Launcher

 'java' - Java Launching Command and Options

Launching Hello.java - My First Java Program

 Option "-classpath" - Specifying Class Path

 Option '-jar' - Specifying Executable JAR Files

 Option '-X' - Specifying Non-Standard Options

 'javaw' - Launching Java Programs without Console

 'jdb' - The Java Debugger

 'jconsole' - Java Monitoring and Management Console

 'jstat' - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jvisualvm (Java VisualVM) - JVM Visual Tool

 'jar' - The JAR File Tool

 'javap' - The Java Class File Disassembler

 'keytool' - Public Key Certificate Tool

 'native2ascii' - Native-to-ASCII Encoding Converter

 Outdated Tutorials

 References

 PDF Printing Version