Setting Up

This page is aimed at Beginners of the Java programming language and using an Integrated Development Environment for the first time. This lesson will help you setup and start developing Java applications using Eclipse or IntelliJ.

Downloading the Java JDK

To begin developing Java based applications, you will need to download and install the latest Java Development Kit or JDK for short.

The latest java version is java 8. Please download this as there will be lessons on specific features which are only available from this version onwards

You can find this at Oracles JDK download page. From here you can select the ‘download’ button under the JDK section:

The Java Development Kit (JDK) contains a runtime environment(the JVM) that runs on top of your computers operating system. It also includes all the tools required to compile, run, archive, document and profile applets and applications written in the Java language. We’ll learn more about each of these features in each of the courses on this website.

java_download_1

Here, you’ll find a list of downloads to choose from. First, you must accept the license agreement, then select the installer specific to your OS:

Run the installer and follow the on screen instructions. The Default installation is good.

java_download_3

Installing an IDE

Now that you have installed Java on your machine, it’s time to install an IDE (Integrated Development Environment). An IDE is a development tool you will use to create and run your programs.

It’s worth noting that there are many different choices of IDE out there. Popular ones include Eclipse, IntelliJ and Netbeans. It is also worth pointing out that programs can be written in text editors and run from the command line using the JDK you have already installed but IDE’s contain many features including auto complete and they continuously compile your code and highlight any errors you have made. So to help us we are going to use an IDE for each of the lessons.

IntelliJ

IntelliJ is fast becoming the De facto IDE for java development in the industry. Using IntelliJ over other IDE’s will simplify the importing of sample projects should you choose to download them.

To download IntelliJ, please go to the IntelliJ download page.

Note that IntelliJ has both a community (free) version and an ultimate (subscription based) version. There will be no future requirement in any lesson to have the ultimate version so you do not need to pay for it!

intellij

Importing the sample project

Once you have IntelliJ installed, please download the example project here and extract the zip folder.

Next, follow this short video to setup and open the sample project:

And to run the starter project:

Eclipse

Eclipse is currently the most widely used IDE for java development in the industry. Using eclipse over other IDE’s will simplify the importing of sample projects should you choose to download them.

To download eclipse, please go to the Eclipse download page:

eclipse_1

Ensure that the correct OS is selected in the drop down menu and choose the Standard Edition.

This will lead you to your download, where you can select the link to download:

eclipse_2

You will notice that the downloaded folder is of a .zip or .tar file format. This is because Eclipse does not need to install itself on your machine. You can just copy the unzipped folder to a location of your choice (I use the Application folder on Mac or Program Files on windows).

From there you can start Eclipse by clicking on the Eclipse Icon:

eclipse_3

If you have successfully installed Java and Eclipse, you will be prompted to create a default workspace. This is simply a folder in your file directory to save your projects to:

eclipse_4

And that’s it you’re nearly ready to run your first program!

Importing Example Project

Ok, lets import and run our first project. You can download the example project here: starter-project.zip

To import this project in Eclipse go to File -> Import. This will open an import window:

project_1

Select Next. You can now import the zip using ‘Select Archive File’ or if you have already unzipped use ‘Select Root Directory’:

project_2

Click Finish. You should now see the project load and open in the ‘Project Explorer’ on the left-hand side (If you do not see this view you can open it using Window -> Show View -> Other -> Project Explorer). You should explore the contents of the project and open the Main.java file by double clicking on it.

project_3

Lastly, you can run the program by right clicking on Main.java and select

Run As -> Java Application. This will print “Hello World” in the ‘console’ view.

In the first lesson of the beginner series, we’ll learn about the project structure and the Main.java class file.

Next: Hello World

Menu