How do you run Java application

1. First take the copy of Java in c: directory. Let the directory name is "Jdk1.3". The main files stored in bin is sub directory of Jdk1.3.

2. Click on Start > Run. Type cmd and click Ok bottom. It will open the Command Prompt of windows.

3. Type edit AUTOEXEC.BAT on Command Prompt.

4. Add a new line in the autoexec.bat file, such as, PATH=%PATH%;C:\jdk1.3\bin;I:\jdk1.3\myproject; myproject is a directory where all java programs stored. Save and close the file. Restart the computer to set the PATH.

5. Type Cd c:\jdk1.3\myproject.

6. Type javac to get help information.

7. Type javac command to compile you program.

8. Type Java app command to run you program.

Note: The file name of Java program must be had .java extension. file:

public class app
public static void main(String[] args)
System.out.println("Hello from JAVA!");

Basic Skill: Finding Java classes with CLASSPATH:

You can set the CLASSPATH environment variable to include that directory. By default, there are no paths or directories in CLASSPATH , but you can add a semicolon - separated list to CLASSPATH like this one for windows.

C:\> SET CLASSPATH=c:\classes;c:\newclasses;%CLASSPATH %

Now the java compiler (and other java tools) will know enough to search c:\classes and c:\newclasses automatically. That means that this code will now work if printer.class (own class) is in c:\classes, because that directory is in CLASSPATH.

Note: CLASSPATH is very important while we compile java program. Remember after compiling a written program in java it creates a .class file which must be stored in that directory which set at CLASSPATH.