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.
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.
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:
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 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.
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 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:
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:
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:
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:
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:
Select Next. You can now import the zip using ‘Select Archive File’ or if you have already unzipped use ‘Select Root Directory’:
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.
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.