Pin Me

JDK Java Compiler: The Java Development Kit

written by: Noel Kalicharan•edited by: J. F. Amprimoz•updated: 12/26/2008

In this article we tell you how to acquire a Java compiler by downloading the Java Development Kit, more popularly known as the JDK. We also tell you how to prepare your program for compiling and execution.

  • slide 1 of 3

    How to acquire the JDK Java compiler

    In Java Example: Algorithm and Program For Area Of Square, we wrote a Java program. In this article, we explain what you need to do to acquire the Java compiler and how to get your program ready for execution.

    First, you need to get a Java compiler. You can compile and run Java programs using the Java Development Kit (JDK, for short) from Sun Microsystems. The latest version can be found at:

    As of this writing, the latest version is JDK 6 Update 7. Go to the site and download JDK Update 7 (or whatever is the latest version). The programs in this series will work with JDK 5 and later.

    When you run the downloaded file (by double-clicking on it), it will install the JDK in the default folder (the numbers after jdk may differ slightly):

    C:\Program Files\java\jdk1.6.0_07

    The compiler, javac.exe, is stored in the bin folder which should look like this:

    JDK Java Compiler Bin Folder 

    You can, during installation, change the default folder and install it in C:\jdk1.6, say. You can make up whatever name you want for the installation folder.

  • slide 2 of 3

    How to store your program

    In Java Example: Algorithm and Program For Area Of Square, we met the following program which calculates the area of a square:

    import java.util.*;

    public class AreaOfSquare {

    public static void main(String[] args) {

    Scanner in = new Scanner(;

    int a, s; //declare the ‘boxes’ to hold side and area

    System.out.printf("Enter length of side: ");

    s = in.nextInt(); //read and store length in s

    a = s * s; //calculate area; store in a

    System.out.printf("\nArea of square is %d\n", a);

    } //end main

    } // end AreaOfSquare

    Next, you must type the program to a file named You must use the same name as the name used in the program. This is required by Java. Also, Java programs must be stored in files that end with .java.

    Java is case-sensitive; this means that it makes a difference if you use an uppercase as opposed to a lowercase letter. For example, AreaOfSquare is different from areaOfSquare.

    You must store your program as a text file. You can use Notepad or WordPad. You can use Word (or another word-processor) but be sure to save it as a text file.

    For convenience, we assume that you have created a folder C:\MyJava and will store your programs there.

    Summary: we assume the JDK has been installed in

    C:\Program Files\java\jdk1.6.0_07

    and your program is stored in a file in the folder C:\MyJava.

    In the next article, How To Compile and Run Java Programs, we show how to compile and run the program.

  • slide 3 of 3


    Java Programming - A Beginner's Course

    Related programming references

    Article: How To Acquire The JDK Java Compiler