Monday, August 6, 2012

Getting a Java Compiler and IDE

Before you can program anything in Java, you are going to need two pieces of software. Both are completely free. The first is the "Java Development Kit" or "JDK" and the second is an editor called "Eclipse". Both are available by download from their respective websites. Below is a guide for installing each.

Getting the Java Development Kit (JDK)

The first step to programming in Java is to install the JDK. The kit provides programmers with the tools necessary to compile, debug, and run their own java programs. It is possible that you already have the JDK from some other program, but it is best to just get the newest version before starting.

The Java Developement Kit can be downloaded from the Oracle website. Once you are there, you should see something that looks like this:

This website changes from time to time, but the download you want is almost always on the left. It's the one that says, "Java Platform (JDK)" and a version number and nothing else. Do not get JavaFX or NetBeans or JavaEE. Click "download," as it is highlighted above, and you will be taken to a new page. Scroll down to the first box that looks like this:

In order to download the JDK, you must first accept the Oracle Binary Code License Agreement. If you agree to the terms listed in the link, click the radio button next to "Accept License Agreement." Then, choose the download link for your operating system. Each operating system has two version, "x86" and "x64". These two type have to do with what kind of operating system you have, 32-bit or 64-bit, respectively. If you have a 32-bit machine (At this date, most people do and 32-bit works on all machines), then click the "x86" link.

Once the JDK installer is downloaded, run the executable and follow the installation wizard. It shouldn't matter where you install the JDK, but the defaults are probably the most safe. For the version we downloaded, it was as simple as "next", "next", "finish". However, after the JDK finished installing, the wizard offered an installation of JavaFX. If this happens for you, close the JavaFX installer and proceed in this tutorial.

Getting Eclipse, an Integrated Development Environment (IDE)

Imagine you want to write a paper. You would probably start by opening your favorite text editor. Good text editors usually have helpful features like spell checking, fonts, page numbers, and printer support. Similar to a good text editor for writing papers, you will want a good Integrated Development Environment (or IDE) to write a program. The best IDE that I can recommend is Eclipse. It has real-time error checking, a nice auto-formatter, extremely helpful auto-complete options, and it suggested fixes for current bugs. You can even access all of the java documentation through eclipse without having to open a browser, just mouse over some code you don't understand and it may be able to help. Eclipse takes a little extra time to learn, but it's worth it for the time you'll save while programming. Here's how you get it:

You will see a page with lots of downloads. Find the one that looks like this:

and click it. Doing so will bring up a page like this:

As you can see, the downloads are on the right. Choose the download that fits for you. And you will see a download and mirror page that looks like this:

The easiest download is the one right at the top that looks like the image above. Just click it and download. If you would like to find a mirror, scroll down for a list of alternate locations to download from.

When the download is complete, you will need to locate and unzip the file. If you have Windows XP or Windows 7, you can right click and "extract all". Mac computers should have an equivalent. If you use Linux, you probably already know all about this. If you are on a computer that does not have an unzip option, or if you are unhappy with you current archive manager, for instance if WinRAR is bothering you to register, download 7-zip and use that.

Eclipse comes in a stand-alone format; there is no installer. Inside the folder you extracted there should be another folder named "eclipse". Put the "eclipse" folder, with everything in it, where ever you want it, then open it up and run "eclipse.exe". If you want a shortcut, take the chance to create one now.

Once you have downloaded and installed the JDK and Eclipse, and Eclipse is running, you are ready to proceed to the next section of this tutorial.

No comments:

Post a Comment