Source: http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html
Create your very first java application:
1. Download JDK and install it using default settings
2. Using Notepad, create a file named `HelloWorldApp.java`.
Note: On this lesson we'll save all files on Desktop.
3. Edit `HelloWorldApp.java` and copy / paste this code:
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
4. Start a Command prompt. Start > Run then type cmd then click ok
Note: Make sure you are on Desktop directory, use `cd` command to do this.
5. On prompt, type: set PATH=C:\Program Files\Java\jdk1.6.0_13\bin\
Note: Change the value of `jdk1.6.0_13` based on your JDK version
6. On prompt, type: javac HelloWorldApp.java
7. On prompt, type: java -cp . HelloWorldApp
This will simply display the text `Hello World!` on the command prompt.
Source: http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment