Thursday, November 4, 2010

Hello World

This is tutorials for absolute newbie people to write the simplest of programs in Java "Hello World."
Requirments: Windows, Mac, or Linux
Time: 5 minutes (not including download time).

1. Go to http://www.java.com/en/download/manual.jsp and download the Java Frameworks for your particular operating system. 


2. Double-Click the downlaoded file and go through the steps of installing the frameworks.

3. Go to www.netbeans.com and download the latest IDE for your operating system and install it to your computer.
4. Double-Click the netbeans file and go through the steps of installing the program.

5. Windows - click START, All Programs, Netbeans, Netbeans 6.xx (x indicating what ever version you have)
Mac - Open your finder, Click the Applications short-cut, double click Netbeans 6.xx

6. You should be at this point (the picture below). If it tells you you need java runtime envoronment, go back to step one and make sure you have downloaded the correct environment. If you have, it should look through your system and find it. The default path of your java Installation is Program Files(x86).


7. Finally its time to write a program! In your netbeans window, click File, New Project. In Categories text tree click Java, in Projects text tree click Java Application.

8. Click Next and enter a name for your Project. Name it "HelloWorld." Never put spaces in your project name. Then Click Finish.

9. It should of created a Main.java file for you.
10.Where it says : //TODO code application logic here
Delete that sentence and add the following sentence: System.out.println("Hello World");

11. Save your program, Now click the Big Green Play Button in the tool bar to execute your program.

12. Finally if all done correctly you have written your first program and the output is below.

run:
Hello World
BUILD SUCCESSFUL (total time: 1 second)

Conclusion: Their are many Integrated Developer Environments (IDE)s out that make your programming easier. This is an example of Netbeans. You could also use Eclipse and more. If you want to write a program from scratch, that will be covered in another tutorial. Their you will have to set environmental variables and jedit.

No comments:

Post a Comment