Wednesday, September 9, 2009

Where do I start?

Welcome to Java Elements, Tips for Beginners. My name is Ray and I will be your host as we explore some of the fundamentals of Java and Java programming. This blog is intended to give me a way to supplement a beginning Java programming class that I teach. Hopefully, it will also prove handy to others who would like a little help getting started with the Java programming language.

There are plenty of sites with information on how Java operates and the theory behind it. One of the best sources of this kind of information is, strangely enough, the SUN website. Really!

I know, I know. Who would have thought that the same people who created Java would also tell you how it works and why it is so cool? Granted, they did all that in a rather staid fashion, but then, SUN is a company (was a company?) that grew up in an era when programming was done on mainframes and took a lot of "geek" power (and math) to do.

Here's the URL to get you started on the SUN site, learning about what Java is: http://java.sun.com/docs/books/tutorial/getStarted/intro/index.html.

With that preamble out of the way, let me get you doing something rather than just reading about doing something.

Like all good artisans (and programmers ARE artisans), you need the right tools (applications) to work your chosen medium (Java).

You can use unwieldy, archaic, build-it-yourself tools like note-pad and the Java development tools, if you really want to. Or, you can use a state-of-the-art Integrated Development Environment (IDE) like Eclipse. Either way, the apps are free.

Let me suggest you start with Eclipse. It's really not that difficult. Just go to the Eclipse website and download the "Eclipse IDE for Java Developers." Be sure to get the latest, production version. (I am currently running Eclipse Ganymede.)

Download and install Eclipse. There, that wasn't so hard, was it?

Once Eclipse is installed, fire it up. Double-click on it's icon or start it from the "start" menu. You know enough to get to this blog, you should know enough to start up an application.

When it starts, it may prompt you for a project directory. Unless you are a real control freak, just take whatever default it gives you.

When the project directory dialog goes away, you may see the Eclipse "Welcome" page. Click on the curved arrow to "go to the Workbench."

Your workbench will usually start out with three panes visible to you (there are more panes that can be viewed and more ways of viewing the ones you have, but we'll talk about that more later). The three main panes are:
  • Navigation (on the left)
  • Workspace (on the top right, taking up most of the real estate)
  • Messages (on the bottom right)
Before you can start writing a program in Eclipse, you will need to create a "project." Projects group your program files together and provide links to the code libraries you will be using. Assuming your installation went smoothly, however, you should be able to build a project using standard defaults relatively easily.

To create a project:
  • Go to File->New and select "Java project"
  • Give your project a name, any name will do
  • The defaults should be OK (Create a new project in Workspace, Use default JRE, Create separate folders for sources and class files)
  • Click Finish
You should see a new project appear in the navigation pane. Click on the arrow next to the project to see the files in your project. You should see a folder labeled "src." This is where we are going to put all your program files.

UP NEXT: Creating a Hello World program in Java!

No comments:

Post a Comment