Search this site
Getting started with Java
On this and the following pages, we'll look at how to get started with Java from scratch. Nowadays, part of learning to program involves learning the language itself, and a part of learning to program effectively also involves learning to use the programming tools, notably what is sometimes called the IDE (Integrated Development Environment). The following tutorial is thus split into:
What do you need to learn/program in Java?
To program in Java using the standard programming tools that we'll look at here, it's much easier if you have a fairly "mainstream" computer: typically running Linux, Windows, Mac OS or Solaris. (Java programs can be run easily on many more platforms than this, but in practice it's easier if you develop on one of the common platforms as there are more tools available.)
Other than a computer with a supported operating system and processor architecture, you will need to download the following:
Although the IDE isn't strictly necessary (you can compile and run Java from the command line), most people will find working with Java much easier if they use one. In the rest of this tutorial, we'll assume you're using an IDE, and part of the tutorial will be to explain the basics of using the IDE.
Java Development Kit (JDK)
Windows, Linux, Solaris
For Windows, Linux and Solaris, the JDK is downloaded from the Java web site. At the time of writing, the JDK can be found as follows:
You'll have to select your particular platform and agree to the licence agreement. You may also wish to consider the option of Java SE Development Kit with NetBeans if it is available for your platform (see below). This gives you a JDK and an IDE all in one bundle.
On Mac OS X, the JDK is actually provided as part of Mac OS and there is no install required. However, it is recommended that you use the Mac OS system upate tool to update to the latest version (if a later version is available than the one you have).
Integrated Development Environment (IDE)
As mentioned on previous pages, the IDE provides you with a text editor specially designed for editing program code, plus a windowed environment to help you manage your projects, search through your code, remind you of parameters to methods etc. The NetBeans and Eclipse IDEs that we mention below are widely used and freely downloadable. Another option is JBuilder, a commercial IDE whose entry-level version is free of chrage.
A generally easy option is NetBeans, developed by Sun. If you are using Windows, Linux or Solaris, then NetBeans is available as an all-in-one package to install the JDK with NetBeans. To download NetBeans with the JDK, follow the instructions above, but select the option Java SE Development Kit with NetBeans. On Mac OS, where the JDK is provided pre-installed, you need to download NetBeans from the NetBeans web site.
Another good opction is the open source project Eclipse. To use eclipse, first download and install the JDK for your platform (on Mac OS, just use the system update tool to make sure you have the latest version). Eclipse is then a separate standard install.
Which Java IDE should I use?
The truth is that for normal programming, there isn't a huge amount to choose between the main IDEs. Some programmers prefer specific IDEs because of specific options that they provide, or because of particular tasks that their favourite IDE allows them to do easily. If your friends/colleagues/workplace use a particular IDE (and it's free), then you may as well use that same IDE. Otherwise, I would suggest starting with NetBeans (I believe its default setup is ever so slightly easier for the beginner), and then down the line when you have a feel for the language, try one of the other options such as Eclipse and see if you prefer it. For most users, there is probably no benefit in paying for a commercial IDE unless you are absolutely convinced that you are paying for a feature that you need and that isn't available in one of the free alternatives.
Some of the IDE-related examples and illustrations in this tutorial are based on NetBeans. But many of the principles are transferrable to other IDEs: they generally operate similarly.
Getting started with the IDE
On the next page, we'll look at the first steps with NetBeans: getting started with your first Java project.
Written by Neil Coffey. Copyright © Javamex UK 2012. All rights reserved.