Downloading and Installing JDK

This page shows how to download and install the latest version of the Java Development Kit (JDK). Read the instructions carefully to set the "classpath" mentioned in Step 3. Once JDK has been installed, you can write a simple Java program using an editor such as notepad and run it from a command prompt. Alternatively, Java programs can be written using an Integrated Development Environment (IDE) such as NetBeans, described below.

5. JDK 11 Launch Single-Source-File New Feature

In JDK 11, you can compile/run a single-file program in one step, without explicit compilation.

  1. Write a "" (see previous section).
  2. Delete "Hello.class", if it exists.
  3. You can compile/run "" in one command as follows:
    // Change directory to the directory containing
    // Compile and Run


  • This is applicable to single source-file only.
  • No need to use javac to compile the program.
  • It compiles in memory (without producing a .class file), and run.
  • This feature is introduced for beginners to learn Java, and for professionals to test a Java feature.
  • The filename and classname need not be the same.