Latest News

Tuesday, August 29, 2017

How to run java program from command prompt ?


1. Write the following code into NOTEPAD.

public class HelloWorld {

    public static void main(String[] args) {
                System.out.println("Hello, World");
    }
}

2. Now save this file as Hello.java.
3. Open command prompt as an admin and locate directory wherever you save this file.
4. First thing you need to compile java  class to write javac hello.
5. Then after if no error appears then write java hello , output will print.

if you haven,t installed java yet then follow this.