Compiling and Running Java Programs

November 10, 2014 0 Comments

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.                 

Jacob Lefore

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google