Friday, 1 March 2013

How do you download and install the JAVA Development Kit - JDK?

This another in a brand new series of videos that I am producing for my new YouTube channel HowDoYouDoStuff.
A channel dedicated to short videos on how to do stuff.

In this video, I am going to show you how simple it is to download and install the JAVA Development Kit - JDK.

You can read the transcript below.

HTML5 player


In this video, I am going to show you how simple it is to download and install the JAVA Development Kit - JDK.
If you plan to do any JAVA development, you are going to need to install the JDK on your machine.
If all you want to do is run JAVA programs on your machine, then you just need the JAVA Runtime Environment or JRE.
In fact, the JDK includes a copy of the JRE so by installing that, you get both. Allowing you to develop and run JAVA programs on your machine.
To download the Java Development Kit, you need to open up the Java SE Downloads page in your browser. A quick way to find it is simply to search for Java SE Development Kit. The SE stands for Standard Edition. There is also EE which stands for Enterprise edition and you should select the one most suited to your needs.
I do not need Enterprise Edition for the work I will be doing in these videos, so Standard Edition will do fine.
Now this path to the JAVA SE Downloads on the Oracle site is a bit long winded but there is something else that you can try.
If you type into the address bar, this will redirect you to the Oracle developers page where you can click on the Java SE link on the right-hand side.
On the Java SE page we have a link to download the Java JDK. Currently the java 7 update 15.
There is another link to it lower down the page.
In addition you will find some demos and samples to download.
For now though, it is just the JDK that I am interested in, so I'll go ahead and click that link.
That redirects me to the download page where I am prompted to accept the licence agreement. Which of course I do.
I can now select the most appropriate installer. As I am working on a 64bit Windows machine, I need to locate an installer for that. And here is the exe that I need.
The browser now prompts me to either run or save the file.
Well I'm going to save the file so that I can easily reinstall later if I have to.
So I'll select this folder here.
This download is going to take about 4 minutes so I'll cut away otherwise this would just be tedious.
OK. So we're back in time to see the download complete.
Let me go and locate the downloaded file.
Great. There it is.
Now to install the JDK, all I need to do is double click the executable file.
I can just click through the initial stages.
Here I am being asked which components that I require. Well I want all of them so I'll click Next. But before I do, look at where the installer is going to put the JDK. It will be placed in the C:\Program Files\Java folder with a name that includes the JDK version. This version is 7 update 15.
Now this next bit can run on for several minutes whilst the many files are installed so I have trimmed this segment of video.
As I mentioned earlier, the JDK includes a copy of the Java Runtime Environment and so here you can see that the JRE will be placed in the c:\program files\java\jre7 folder.
Here we have another lengthy segment while the JRE files are installed so I have trimmed this segment also.
Once all the files have been installed, I can click Close and we're done.
A registration page will pop up in your browser and if you want to fill that in then go ahead. I'll just close it down.
Let's go and take a look at what has just been installed.
If I navigate the c:\program files\java folder you will see both the JDK and JRE folders.
If I drill down into the JDK folder I will find a number of files and folders. Perhaps the most important for now is the bin folder as this is where the javac.exe file can be located. This is the tool that is used to compile your java code. Alongside it is also java.exe which is needed to execute your compiled programs.
OK. The JDK is installed but we need to set up some environment variables in order to use and test it.
I need the path to the JDK folder so I'll copy it from the address bar here in Windows Explorer.
The quickest way to locate the Environment Variable dialog is to search for it by clicking on the Start Button. Up comes the link and so I'll select that.
The System Properties window appears with the Environment Variables button in the bottom right.
Instead of finding it in that way, you could expand the All Programs menu and right-click on Computer before clicking Properties.
Once this page appears, you can click on the Advanced Settings link in the top left hand corner.
And here we are back in the System Properties window.
Whatever works for you.
So let me click on the Environment Variables button.
I need to create a new variable named JAVA_HOME. This variable name is sought out by tools such as Apache Tomcat and should point to your JDK folder if you have one.
So I will type in the name of JAVA_HOME and then paste in the path that I copied from the JDK folder a few moments ago.
Another thing that I need to do is update the Path environment variable. This is important if you plan to do any work at the command line which I do.
When attempting to compile code at the command line, Windows needs to know where to locate the javac.exe program.
So I'll edit the Path environment variable and append a semi colon to any existing paths and then add the JDK folder name. I then need to append \bin because that is where the javac.exe program resides.
So now that is done, I just need to test that everything is working.
Let me switch to the command line.
As I am not in the JDK folder, I am relying on the Path environment variable to help Windows locate the javac and java programs when I try to execute them.
Let me start with java. I'll enter java followed by the version switch and press enter. As you can see, the program ran and gave me the version. This proves that Windows was able to use my Path environment variable to locate the JDK files.
I'll try the same with javac. I'll type javac followed by the version switch and once again, I get a result.
There you have it.
In this video, I have shown you how easy it is to download and install the JAVA Development Kit - JDK. I downloaded the JDK. Installed it and then created some environment variables to help me use it. Finally, I tested my configuration by executing java and javac from the command line.

Flash Player


See you soon

Phil Stirpé
"I don't do average!"

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.