Monday, January 29, 2007

Running a .java file

Lets know how to run a program written in java. For this you need to take the following steps:-
1) J.D.K(java development kit) which you can download from www.sun.com
2) Then go to 'command prompt(cmd)' from start>run>cmd
3) Then give the path wher you have installed J.D.K. and type
(edit , eg: edit demo.java)
4) Then type the program
5) Then type (javac , eg: javac demo.java)
6) If the program is executed successfully then type
(java , eg: java demo1)
------------------------------------------------------------------------------
Filename
------------------------------------------------------------------------------
class demo1
{
public static void main (String ar[])
{
System.out.println("Hello World");
}
}

Result:
Hello World
-------------------------------------------------------------------------------

No comments: