Compile and Run Java Programs

This section describes how to compile and run Java programs.

When JDK is installed on your machine, it provides two commands for you to compile and run Java programs.

Let's try these commands with a very simple Java program. Use NotePad to enter the following Java program into a file called Hello.java:

class Hello {
   public static void main(String[] a) {
      System.out.println("Hello world!");
   }
}

Then compile this program in a command window with the "javac" command:

herong> javac Hello.java

To execute the program, use the java command:

herong> java Hello

Hello world!

Congratulations, you have successfully entered, compiled and executed your first Java program.

Table of Contents

 About This Book

 JDBC (Java Database Connectivity) Introduction

JDK (Java SE) Installation

 Downloading and Installing JDK

 Adding JDK "bin" Directory to Path Setting

 Downloading and Installing JDK on Mac

 Downloading and Installing JDK on Linux

Compile and Run Java Programs

 -cp or -classpath Syntax on Different Systems

 JDK Documentation Installation

 Oracle Express Edition Installation on Windows

 Oracle JDBC Drivers

 Oracle - Reference Implementation of JdbcRowSet

 Oracle - PreparedStatement

 Oracle - JBDC CallableStatement

 Oracle CLOB (Character Large Object) - TEXT

 Oracle BLOB (Binary Large Object) - BLOB

 Using Connection Pool with JDBC

 Archived Tutorials

 References

 Full Version in PDF/EPUB