Compiling and Running Java Programs

There are various steps to compiling and running java programs, these are
Step-1 : First to install JDK, JRE and JVM into the System.
Step-2 : Prepare source code in any editor like notepad, c++ editor etc.

class HelloWorld
public static void main(String r[])
int a=10, b=10,c;
System.out.println("Output of the program is"+c);

Step-4 : Save the source code in the java bin directory. Class name which contain main method should same of the file name.
Example :  HelloWorld (class name)
         (file name)

Step-5 : Open command prompt and change the directory where your java program has been saved.
Suppose your java software installed in C:/>. Now, compiling steps is:

C:/java/jdk1.7.0/bin> Javac   (press Enter)
C:/java/jdk1.7.0/bin> Java    (press Enter)

Step-6: During compilation, if program generate errors, it means you can't run your program.                 


Popular posts from this blog

difference between structure and union in C Language

Difference between Linear search and Binary Search in c language

Difference between static and dynamic websites