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 11 Downloads page at the url https://www.oracle.com/in/java/technologies/javase-jdk11-downloads.html. Alternatively you can search 'java se development kit 11 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 11 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 Oracle JDK (eg. Java Platform (JDK) 11.0.1 or JDK; NOT Server JRE or JRE). It will take you to the Java SE Development Kit 11 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. -jdk-11.0.1_windows-x64_bin.exe).

5. Now you will be prompted to login to oracle account. If you done have one , create and signin. By sigining in, it automatically downloads the executable

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

7. 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.

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

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

10. 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. 

11. To set path, find the path of your javac.exe and java.exe in your system. For me it is C:\Program Files\Java\jdk-11.0.1\bin.

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

set path=%PATH%;

13. 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. 

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

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

16. 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 

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?

hi,   i installed jdk ,jre is not installed automatically. can you tell reason

Was it useful?

Quick Notes Finder Tags

Activities (1) advanced java (1) agile (3) App Servers (6) archived notes (2) Arrays (1) Best Practices (12) Best Practices (Design) (3) Best Practices (Java) (7) Best Practices (Java EE) (1) BigData (3) Chars & Encodings (6) coding problems (2) Collections (15) contests (3) Core Java (All) (55) course plan (2) Database (12) Design patterns (8) dev tools (3) downloads (2) eclipse (9) Essentials (1) examples (14) Exception (1) Exceptions (4) Exercise (1) exercises (6) Getting Started (18) Groovy (2) hadoop (4) hibernate (77) hibernate interview questions (6) History (1) Hot book (5) http monitoring (2) Inheritance (4) intellij (1) java 8 notes (4) Java 9 (1) Java Concepts (7) Java Core (9) java ee exercises (1) java ee interview questions (2) Java Elements (16) Java Environment (1) Java Features (4) java interview points (4) java interview questions (4) javajee initiatives (1) javajee thoughts (3) Java Performance (6) Java Programmer 1 (11) Java Programmer 2 (7) Javascript Frameworks (1) Java SE Professional (1) JPA 1 - Module (6) JPA 1 - Modules (1) JSP (1) Legacy Java (1) linked list (3) maven (1) Multithreading (16) NFR (1) No SQL (1) Object Oriented (9) OCPJP (4) OCPWCD (1) OOAD (3) Operators (4) Overloading (2) Overriding (2) Overviews (1) policies (1) programming (1) Quartz Scheduler (1) Quizzes (17) RabbitMQ (1) references (2) restful web service (3) Searching (1) security (10) Servlets (8) Servlets and JSP (31) Site Usage Guidelines (1) Sorting (1) source code management (1) spring (4) spring boot (3) Spring Examples (1) Spring Features (1) spring jpa (1) Stack (1) Streams & IO (3) Strings (11) SW Developer Tools (2) testing (1) troubleshooting (1) user interface (1) vxml (8) web services (1) Web Technologies (1) Web Technology Books (1) youtube (1)