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