To compile the java hello example, we need to install a set of special java programs called java jdk (Java Development Kit). You can download the latest java jdk from java sun microsystems website at
http://java.sun.com/products/jdk/1.2/ and install by running the setup file. Java jdk is a free to download and use.
When you installed the jdk we need to configure computer to to use the jdk features within any directory. To do this we need to add followig lines to systems Autoexec.bat file. Generally autoexec.bat file is found on the C:\ drive. Open it with the notepad and add this line then restart the computer to apply modifications.
PATH=C:\WINDOWS;C:\JDK12\BIN;C:\JDK12\LIB
here I have installed the java jdk to C:\JDK12 directory. Use whatever the path you installed the java jdk. Now you have successfully installed and configured java jdk. Now lets compile our hello example into a java applet.
Compiling the hello applet
Java applet is a 'class file', that mean java applet always have the file extention .class. Now we are going to compile out hello.java file into a hello.class file using java jdk.
Go to the command prompt and change to the directory where we saved our hello.java file. Here I saved my file to,
c:\java12\hello>
Now type this java command to compile the applet;
c:\java12\hello>javac he
llo.java
Java compiler will now create a java.class file and it is a ready to go java applet. You will see both hello.java and hello.class files in the folder.
Next we will learn how to embed this java applet to a html webpage and view it.