Friday, December 31, 2010

Getting Started

Alright, I've got the blog and the goal of teaching myself Java programming. What's next?

The first thing I did was found the Java download page:

I downloaded and installed the JDK (Java development kit) + NetBeans bundle. It took forever to download and install and even longer to load NetBeans once it was installed. So I uninstalled NetBeans and Java and went back and downloaded the JDK by itself. That's all you really need to get started. Well that and a text editor, but there are more text editors than I care to list.

So, I'm now armed with a new programming language, but I don't know how to use it. I need some help. I searched and found the Java documentation at:

I downloaded and unzipped the files to my Java install folder. I clicked the index file and my web browser opened and a couple clicks later I was starting the "Hello World" tutorial:

So here's the tutorial.

Open Windows Notepad (Programs > Accessories > Notepad). Type the following text:
 * 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.

Save this file as "". Make sure you type correctly. Java is case sensitive. That means "" is not the same as "".

Open a command prompt (Programs > Accessories > Command Prompt) and navigate to where you saved "". To do this, type CD followed by the directory path. Here's a picture to show what I mean:

You should see your command prompt change

Type the following command and press Enter:
This gives us a new class file
We run our new class file with the following command:
java HelloWorldApp
That's our first Java application!

No comments:

Post a Comment