In our one guide we have shown how to install JDK 11 on Windows. JDK 8 is often among the prerequisites of various developmental tools. In this guide, we will discuss the steps to correctly install JDK 8 and configure the PATH. Basics on JVM has been already discussed and we will not repeat. Often, many of the developmental tools support specific version of Oracle JDK (same goes to JDK from the other distributions). One Windows machine may need to have JDK 11, JDK 8 etc. Configuring/editing the PATH makes a particular version active. Unless you properly configure Java, trying to run the program will throw error 13. Oracle in recent time changed their licensing policy. In order to install JVM 8, you have to sign-up to download the installer. Although it does not cost anything, it is an additional work. JRE (Java Runtime) is required for running Java programs. JDK (Java Development Kit) includes JRE plus the development tools needed for writing as well as running Java programs. You can download JDK 8 from Oracle’s website.
Run the installer which will look like something closer to jdk1.8.0_231_windows-x64_bin.exe
. JDK will be installed in C:\Program Files\Java\jdk1.8.0_231
. Open File Explorer to navigate to C:\Program Files\Java
to check the files. You’ll find javac.exe
inside the bin directory. That file is our need.
How to configure the PATH of JVM installation
Open Control Panel and search with “Advanced system settings”. A window will open with the “Advanced” tab active. You’ll notice the “Environment Variables” button at its bottom. Click it. It will open a bigger window. There will be “User variables” and “System Variables”.
---
It will add the PATH to the “User variables”. That means, it remains under my user-named account. Some add the PATH to the “System Variables”. Click “New…” button and add the data like below :
1 2 3 4 5 6 | ================================================= Variable name : PATH Variable value : C:\Program Files\Java\jdk1.8.0_231\bin ================================================= |
Click the OK buttons to save the changes. This entry alone enough to do 90% works related to Java. Again, add another entry under “User variables” (like above) :
1 2 3 4 5 6 | ================================================= Variable name : JAVA_HOME Variable value : C:\Program Files\Java\jdk1.8.0_231 ================================================= |
Click the OK buttons to save the changes. This entry alone enough to do 95% works related to Java. Again, add another entry under “User variables” (like above) :
1 2 3 4 5 6 | ================================================= Variable name : CLASSPATH Variable value : C:\Program Files\Java\jdk1.8.0_231\lib ================================================= |
Click the OK buttons to save the changes. The above two entries are optional as some IDE and programs seek the entry of JAVA_HOME
. You should remember these additions. If these entries create conflict in some program, remember to remove it.
Now, open Command Prompt. Here, we will check whether our settings are making to respond to commands correctly. Run these three commands one by one :
1 2 3 4 5 | # path javac -version java -version # |
path
command will return what we have given as the variable value, i.e. PATH=C:\Program Files\Java\jdk1.8.0_231\bin
. If the others return meaningful output then your installation is fine.
Testing Compilation and Run
Create a file named Example.java
in C:\Apps
using Notepad. Be careful to save it as All files
to avoid creating Example.java.txt
. Copy-paste the below content :
1 2 3 4 5 | public class Example { public static void main(String[] args) { System.out.println("This is an Example"); } } |
I am not going into programming details. Java is like C++.
Run these commands from command prompt :
1 2 3 4 5 6 7 8 9 10 | # cd C:\Apps dir # compilation javac Example.java # check, there will be a class file now dir # run it java Example # |
Delete the files to avoid confusion later with system files.
Switching Between JDK 11 and JDK 8
Not exactly easy on Windows. In case, you are changing from JDK 11 to JDK 8, then you have to change the PATH like shown above. Then restart the computer.
Tagged With Java 11 or more recent is required to run Please download and install a recent JDK , hwo to run jdk1 8 0_231 jdk catalina , jdk1 8 0_231 , jre for jdk1 8 0_231 , java 8 or more recent is required to run please download and install a recent jdk , java jdk1 8 0_231 , java 1 8 installation in windows 2019 , install jdk windows 2019 , java 8 installation in 2019 windows , steps to install jdk8 231