Monday 7 September 2015

Java – Environment Setup

JRE & JDK environment setup:

Before we can start creating awesome java programs we first need to install the Java Development Toolkit (JDK). You can find this on the main download page provided by oracle (here), or by doing a quick google search for “Install JDK latest version”.

Once you have downloaded the JDK, run the executable and follow the installation steps.
I recommend that you specify the JDK installation path as something easy to remember because we will be needing it again in a later step. Use a path such as ‘C:\Java\jdk18’. When the installer prompts you to install the Java Runtime Environment (JRE) install it so a path name similar to the JDK, such as C:\Java\jre8.

Once the installation is complete, open up your command prompt. You can does this by searching for cmd in the windows start menu.
To verify that Java is in our environment type the following command ‘java –version’. This will display the current version of Java installed on your machine and the JRE build. If you see these two things it means that the installation was a success.

If your computer couldn’t locate Java try reinstalling the JDK.

We are almost there, we just need to set one more environment variable. This step is very important!
On windows open ‘advanced system settings’. An easy way to do this is by searching for ‘view advanced system settings’ in the start menu. Select the ‘Advanced’ tab and press the button in the bottom called ‘Environment Variables’.

Now we need to add a new system variable with the following details;
-          Variable name: JAVA_HOME
-          Variable value: C:\Java\jdk18

Please note that your ‘Variable value’ is the location of the JDK that we installed earlier.
Press OK, and open up a new command prompt (this is required). Type ‘echo %JAVA_HOME%’. After doing this you’re done.

Congratulations, you have successfully set up your Java Runtime Environment (JRE) and Java Development Kit (JDK) environment.
Don’t worry about trying to memorize all of these steps as you shouldn't need to do it that often. Although it doesn't hurt to know how to do it.

IDE Installation:

For these tutorials we will be using a very popular Integrated Development Environment (IDE) called NetBeans. NetBeans is created by Oracle, the people who created Java, so it is an excellent IDE to begin with, and isn’t as cluttered as others. If you have your own preference of IDE, such as Eclipse or IntelliJ.

Firstly we need to download NetBeans, a quick google search of ‘NetBeans IDE download’ will allow you to locate a place to download the IDE from. Or you can just click here.
You will be presented with different versions of NetBeans to install, select ‘Java SE’, which stands for Java standard Edition, the file should be around 90MB in size.

After the download completes, run the installer by double clicking the .exe extension.
The installer will guide you through installing NetBeans on your computer.
 If you followed the previous tutorial where we installed the JRE and JDK runtime environments to the non-default path, you may need to specify the path which you did install them to if prompted by the NetBeans installer. The file path from the previous tutorial looked something like this, C:\Java\jdk18.

When asked for a location to install NetBeans you may choose a custom path, or leave it as the default.
Before the installation begins you will be presented with a summary page. Check this page to verify that all the components listed to be installed are correct.

We recommend that you select the ‘Check for Updates’ checkbox so that NetBeans will automatically check for future update releases.

Click Install to begin the installation.

After the setup is complete, click Finish.

Congratulations on completing all the tedious boring stuff. If all went well you are now ready to move onto the next tutorial and start writing your very own computer programs. Wooo!
   



No comments:

Post a Comment