Downloading, Installing and Configuring Java First Time

Here we will discuss the details of downloading, installing and configuring java for first time. You will first find the steps in writing followed by complete screenshots of these steps as a slideshow.

Steps

1. Go to Java SE Development Kit 7 Downloads page at the url http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html. Alternatively you can search 'java se development kit 7 downloads' in google search and reach this page. You should be seeing the Java SE Development Kit download area with license agreement and download links for various operating systems.

If you reach this page successfully, go to step 3 skipping step 2.

This is a Java 7 specific note, if you are looking for Java 8, download from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2....

2. If you can't reach above page directly, you need to go to the Java SE Downloads page at oracle.com at http://www.oracle.com/technetwork/java/javase/downloads/index.html. In the download page, click on download button for JDK (eg. Java Platform (JDK) 7u25 or JDK; NOT JDK 7 + NetBeans, Server JRE or JRE). It will take you to the Java SE Development Kit 7 Downloads page as shown above.

3. In the download box, first you must accept the Oracle Binary Code License Agreement for Java SE to download this software. First click the link Oracle Binary Code License Agreement for Java SE and then click Accept License Agreement. Now you will see a message "Thank you for accepting the Oracle Binary Code License Agreement for Java SE; you may now download this software".

4. Now click on the download link for your operating system (eg. -7u25-windows-i586.exe).

5. Once downloaded, double click the executable ( assuming you are in windows) to start installation.

6. Keep clicking next to install the JDK with default options. If you want to change the installation directory, you can do it within this installation process.

7. Finally once the installation is done, exit the installed using close button.

8. Once installed, open command prompt (type cmd in run and press enter). 

9. Try executing javac and java to see if they are on the path. If you get get "Command not found" error message then the command is not on the path and you need to add them to path either through command prompt or through Environment variable settings page. 

10. To set path, find the path of your javac.exe and java.exe in your system. For me it is C:\Program Files\Java\jdk1.7.0_07\bin.

11. Windows and linux has slightly different commands for setting path variable through command line. In windows you can do as below:

set path=%PATH%;

12. If you set as above through command prompt, you will have to do this every time you open a new command prompt. You can actually do it permanently by setting the PATH through Environment variable settings page. 

13. You can reach Environment variable settings page by right-clicking MyComputer -> select properties -> Advanced System properties -> Environment Variables.

14. Now select the PATH variable, edit and add our path seperated from the rest using a semicolon (in windows). 

15. You can optionally set our CLASSPATH variable in a similar way. To see in detail what PATH and CLASSPATH are and how to set them, please see the notes below the screenshot slideshow. 

Sample Screenshot Slideshow

Note:

JDK vs JRE

JDK stands for Java Development Kit and JRE stands for Java Runtime Environment. To run a java application you need JRE and to develop java applications you need JDK. When you install JDK, JRE will be automatically installed, but not the other way. Please see jdk-jre-jvm-and-your-first-java-program.

PATH vs CLASSPATH

The PATH environment variable contains a set of directories within the file system that the operating system uses to find executable files like java.exe and javac.exe.  The CLASSPATH environment variable contains a set of directories within the file system or JAR file loactions that JDK/JVM will search for Java class files while compiling/executing a Java program. Refer to javajee.com/path-vs-classpath#overlay-context=path-vs-classpath for mroe details. 

Comments

Good Article :)

Was it useful?

What is  the difference between  JDK and eclipse java development tool ?

Was it useful?

JDK is the java compiler which contains javac.exe, eclipse is an IDE (Integrated Development Environment). In simple terms, eclipse is a GUI tool which allow you to easily program and it contaiins a default compiler. You can configure eclipse to use any JDK you have installed for compiling. Eclipse will aotocompile for you and tell you of any erros while you type the program. Without IDE tools eclise, netbeans etc you have to execute the program in command prompt to directly compile using your JDK. I would suggest you to try out your initial programs on command prompt and then use eclipse.
Hope it is clear now and you have already understood what is JDK, JRE, the compiling and executing process etc.

Was it useful?

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!