Sunday 17 July 2011


The following is the code of program we want to compile and run
public class HelloWorld
{
public static void main(String args[])
{
System.out.println("Hello World");
}
}
Save it with the name HelloWorld.java
Now Suppose we save it at D:\java
First we change to D:\java by using cd as shown in image


Now we compile and run it like this
javac HelloWorld.java
java HelloWorld
see the image


If you get an error saying javac was not recognized as an internal or external command or batch file
then you need to set path of javac
So right click on My Computer and select Properties
Now go to Advanced
Now create a new Environmental variable with the value to the bin folder of java

1 comment:

  1. Thanks
    I used to got that error but not now

    ReplyDelete