Java 101 – Lesson 1 – Installing the JDK

Since this is the first class, I guess I should talk about what Java is. Java is a language that can be used to write platform-independent desktop applications or web applications. The term “Platform independent” means that you can write the code for an application on Windows and run it in Linux or a Mac (as long as you have a JVM installed). In fact, you can run your program on any device – not just computers – if that device has a JVM available for it.

The story of how Java came into existence is very interesting. The first release of Java was in 1995. In the last 14 years, Java has come a long way from being something that just integrated into Netscape to being one of the most widely used languages in the computer industry.  I don’t want to bore everyone with the details of the history of Java’s birth so those who are interested can go to : http://java.sun.com/features/1998/05/birthday.html

How does Java work, you ask? When you write code in Java, you need to compile it using the javac command. When you compile your code, it is converted to “byte-code”. This byte-code is later read by JVM when you run your application using the java command. So, it’s a 2 step process.

To be able to make program in Java, you need to install the JDK (Java Development Kit). JDK comes with quite a few things but the ones we are interested in are the compiler, and the JVM. You may also have heard the term JRE (if you’ve ever had to install the JRE plugin for Internet Explorer). JRE stands for Java Runtime Environment. You can run Java applications with it but you can’t compile them.

Let’s get started with the installation then. Download the latest version of JDK from : http://java.sun.com/javase/downloads/index.jsp . The latest version of JDK is JDK 6 update 12 as of this writing. Here’s a link to download JDK6 update12 https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jdk-6u12-oth-JPR@CDS-CDS_Developer. Select your platform, etc and depending on your the speed of your internet connection, it should be done fairly quickly.

Double click the file you just downloaded and it will start the installation process. Follow the instructions that come up and after it’s done you should be ready to write code Java code – assuming nothing went wrong.

J2SE download
J2SE download

For Windows :

You have java installed, but now you need to add it to your path. Path is an environment variable in windows. All the folders in this variable are searched for, when you try to run a program without providing its location.

Click start then right click on “My Computer”. Select “Properties” from the menu that pops up. Go to the “Advanced” tab and press the “Environment variables” button in it.

Getting to system properties
Click to enlarge
Environment Variables
Click to enlarge

In the dialog that opens up, you will find a variable called path. Click on it and click on the edit button. If you have installed the JDK in the default path, then your JDK will be installed in C:\Program Files\Java. You need to get the location for the bin folder in your JDK. For, JDK6 Update12 it is : C:\Program Files\Java\jdk1.6.0_12\bin . Go to the end in the “Variable value” textbox and type ; then type in the location to the bin folder for your JDK. In the end you will have written something like this :

;C:\Program Files\Java\jdk1.6.0_12\bin

Here’s a few pictures to make things easier 🙂

Click to enlarge
Click to enlarge
Click to enlarge
Click to enlarge
Click to enlarge
Click to enlarge

And, viola! You’re done.


Posted

in

,

by

Comments

2 responses to “Java 101 – Lesson 1 – Installing the JDK”

  1. […] know what I am talking about, please refer to the previous articles in the Java 101 series (lessons 1, 2 and 3). In this article, we will take a look at variables and how to use […]

  2. Thankful Avatar

    Thank you! I’m reintroducing myself to Java – it’s been a while. I wish I had this when I went to install – would have saved me hours…

Leave a Reply

Your email address will not be published. Required fields are marked *