Wednesday, January 4, 2012

Programming (in Java): Eclipse, you, and your very own "Hello World" project.

Mwah hahahahahahaha!
Happy Evil Laugh Wednesday, everyone:

In this post, I am going to talk about some of the basics of programming. We will begin with Java, and, if we are lucky, we may continue on to C# and other languages. 

First thing, make sure you have something to code with. I prefer Eclipse(No, not twilight), created by Oracle. There is also Netbeans, which can help with further GUI things. However, we will be doing the majority of our work here, in Eclipse. Here is the link to the Eclipse download list, as well as part of the Oracle website: http://www.oracle.com/technetwork/developer-tools/eclipse/downloads/index.html. Also, make sure you have Java downloaded on your computer. If you do not, the download should be on the same website.

Next, extract the files, it will be good for you. Once everything is set up, open Eclipse, and it will probably ask you for a location to put all your things. I prefer to put it in a default location, but you can put it anywhere you want. 
Now, we are going to get into the classic, simple program of "Hello, World!" (Trust me, it's not fun, but it's essential). Find the package manager, which should look like this
Where the magic happens...
Now, right click the side that has the tab that says, "Package manager", and select "New". This should lead into a great many things, such as "Project..." and probably "Java Project". If Java Project is shown, then just click it. If not, click "Project..." and find it. Please note that "Project..." does not mean that the person who typed it was depressed or anything, but it is just leading on to other things. Now, when you try to create a project, it looks like a form that you need to fill out. It's not paperwork, it's just a program. Now, type in "Hello World" into the package name. It should now look like this:
Creating your Java Project

Click 'finish' after you have come up with your name. Now, you can right click 'src' (your source code) and create a new Package name and Class name.

This is the part where I will describe how to do the programming of this program.
Hello World:
Well, the Hello World program  is very simple. When you go onto the 'Create a new class' screen, which should look like this:
Click the circled button for a very quick way to finish
Now, the button that has 'public static void main(String[] args)' is very important. Clicking it will input the code in the actual class, so I recommend you click it, or you could type it. Once you do that, a class should appear, entitled after what you named it.  If you did click on the button, as I recommended, your product should look like below:
If you look on the bottom part of the page, you see the word 'Warnings (3 items)'. You don't have to worry about these yet, but you should really worry about these things. I mean, they are warning you about something, almost always bad or questionable. For example, if you had a boulder coming towards you at 150 mph, it would be really nice for a warning once in a while. These are like that, but better, as they can't kill you, but can significantly cause problems in various areas.
Type in System.out.println("Hello, World!"); in between the two squiggles, open and close ( { } I call them squiggles). It should look like this:
You are almost finished! Aren't you glad that you don't have to look at this 'amazing' program anymore???
Alright, now, click run. In the "Project" box, it should say, "Hello, World!".

And that is what Hello World is. I think I should win a medal because this over explains how to program it. 

Thank you for reading, dear reader, and have a good day.

=-The Rich Man known as Thursday (Note that I am not actually rich, but it's just an attitude towards everything)

No comments:

Post a Comment