Save the file as HelloWorld.java [This file name should be the class name]
Open the Command Prompt.
Type "path=C:\Program Files\Java\jdk1.6.0\bin" [This path can be change due to the JDK version. Check your java bin path]& enter.
Type "cd folder which the java file has been saved"
Enter
Then type "javac Helloworld.java" and enter.
Type "java HelloWorld" and enter
The message will be "Hello World!"
0 comments:
Post a Comment