How to Fix "Java Runtime Environment not found" error {Windows 10 and Ubuntu 20.04}

In this post, we will solve "Java Runtime Environment not found error". This java error is one of the common error faced by developers or end-users. Whenever you try to install any software which requires java like eclipse or Minecraft. Also, if you are new to java development, JDK or Java Development Kit is necessary for you.

Following this tutorial will help you to resolve all Java runtime errors. Additionally, you will learn to install, remove and set java variables in Windows10 and Ubuntu.

These are the very common errors you will find related to Java.

  • java runtime environment not found
  • java runtime environment not found windows 10
  • eclipse java runtime environment not found
  • eclipse java runtime environment not found path
  • java SE runtime environment not found
  • java runtime environment not found at bin javaw.exe
  • unable to load java runtime environment
  • cannot determine a valid java home
  • java runtime environment not found mac

Let's understand some basic concepts of Java runtime first

what is a runtime environment

Runtime basically means everything you require to run a program. Which includes environment variables, directory structure, common libraries etc. This can also be a virtual machine like

  • JRE (Java Runtime Environment)
  • CLR (Common Language Runtime) for .net framework

Target would be JRE or CLR for your program, need to decide by you. As soon as you execute any program, it's in run time.

JRE vs JDK

JREJDK
Stands for Java Runtime EnvironmentStands for Java development kit
To run Java programs, you need JREHelps to build Java programs and applets
Platform dependent contains libraries and supporting toolPlatform dependent contains tools development and debugging
JRE does not contain development kit.JDK includes JRE also to execute the program
Simple JRE VS JDK

What are causes of "Java Runtime environment not found" error

  1. Java is not installed in your system
  2. Java installation not completed (due to errors)
  3. Environment variables of Java are not set
  4. Java conflict due to more than one Java Runtime installation

Because JRE is platform-dependent, I have covered java installation, variable setup and un-installation for Windows and Ubuntu both.

Choose Windows 10 or Ubuntu 20.04 from the post and follow step by step to get java issues resolved.

Java download

Before installation, first we need to download java -

Step1

Visit oracle.com and download JDK 15 or latest available for your system. I am downloading it for Windows 10 (64-bit). Latest available versions of java are listed in the screenshot.

java-download-windows10

How to install Java runtime environment step by step

Let's solve 1st reason of "Java runtime environment not found", Because of java is not installed.

Step2

First check for any pre-installed java version -

Open command prompt with "Run as administrator" and run java command.

C:\Users\admin> java --version
java-version-check

How to install java runtime environment in Windows 10

Step3

Once Download completes. Browse to "jdk-15.0.1_windows-x64_bin.exe" file and double click on it, to run installer. Click Next.

how-to-install-java-windows10

Step4

I recommend to keep "C:\Program files\java\jdk-15.0.1 (64-bit)" as default installation folder. Select Next.

You may select different installation folder also. For example, if you are installing second instance of java software. Click on change and browse for target folder.

Java-runtime-default-installation-folder

Step5

Let installation complete, it may take few minutes.

java-runtime-environment-installer

Step6

Click close. Now you are done with java installation on windows 10.

java-runtime-environment-not-found-solved

How to set environment variable for java in windows10

Set Environment variable for java in windows 10 by these steps -

Step7

Type "environment" in search window. Click "open" on "Edit the system environment variables"

environment-variable-windows10

Step8

Click on Environment variables.

java-runtime-environment-variable

Step9

Select "Path" > Then click Edit.

How-to-set-environment-variable-for-java

Step10

Select New > Give path of java installation directory > For example, "C:\Program files\java\jdk-15.0.1\bin" in my case. If you have selected different folder for java installation in step4. You can enter your path till bin folder.

Click OK.

How-to-set-Java-runtime-environment-variable

Step11

Set "classpath" for java. Click "New" in environment variable window. It allows to setup new environment variable.

How-to-set-classpath-variable-for-java

Step12

In "Variable name", enter "classpath". Also in "variable value" provide path to your java installation till "lib" folder. In my case it is "C:\program files\java\jdk-15.0\lib > Select OK

How-to-set-classpath-java-runtime-variable

Close all open environment variables windows by selecting OK.

How to check what version of java i have ?

Installation and java variables have been setup. Now, Let's validate java installation and version.

Step13

Open command prompt with "run as administrator" rights in windows 10.

windows10-command-prompt

Step14

Run "java" command to check your Java and JRE (Java Runtime Environment) version.

java --version
check-which-java-version-i-have

Check java SDK version with javac command

javac version

Video tutorial-JRE error solved for Windows

"Java Runtime Environment not found" error fixed for windows 10

How to uninstall java from Windows 10

In case, you are not happy with your old java or JRE version and want to install new. For that, you need to remove old java version.

Cleanup of Java from windows 10 is pretty easy. Follow these steps to remove java from your system.

Step15

Search add or remove programs and click open

remove-java-windows10

Step16

Select java program and click Uninstall.

uninstall-java-runtime-environment-windows10

Java software will go from window. You can cleanup java variables also, setup in step10 and 11 earlier.

How to install java runtime environment in Ubuntu 20.04

There are two ways to download and install java or JDK in Ubuntu 20.04

A.) Using apt command

B.) Download Oracle JDK package and install manually

Let's see both options one by one-

A.) How to install java or JRE in Ubuntu 20.04 using apt command

To install java in Ubuntu using repository, Follow these commands

Step17

Update package index using apt command

$ sudo apt update
sudo-apt-update

Step18

Check if you have any old java version installed in system. In my case, java is not installed.

$ sudo java -version

output

Command 'java' not found, but can be installed with:

sudo apt install openjdk-11-jre-headless              # version 11.0.9.1+1-0ubuntu1~20.04, or
sudo apt install default-jre                                      # version 2:1.11-72
----------------------output-truncated------------------------------------

Step19

Run "apt" command to install java or JRE. I will install default-jre version 2:1.11-72 in my Ubuntu system from list.

$ sudo apt install default-jre
install-java-runtime-using-apt-ubuntu

Select "Y" and press Enter. Let installation complete. it will take few minutes.

Step20

Check java version

$ sudo java -version

output

check-java-runtime-enironment-ubuntu-20.04

How to Remove java from Ubuntu 20.04

Step21

Run apt command to remove JRE package installed. Press Y and then enter.

$ sudo apt autoremove "JRE package name"
clean-java-from-ubuntu

B.) How to install latest java or JDK in Ubuntu 20.04 from oracle (manually)

Step22

Java JRE download steps -

Visit oracle.com and download JDK 15 or latest available .deb and transfer to your system. I am downloading Debian package jdk-15.0.1_linux-x64_bin.deb.

java-jre-download

Alternatively, you can download java using wget command.

$ sudo wget "download link"

Reference output

java-runtime-environment-download

Step23

Rename .deb file using mv command, if required. Then install Debian package using dpkg command.

Learn more ways to install .deb package.

$ sudo dpkg -i ".deb-file-path"

output

how-to-install-java-runtime-environment-ubuntu

Default installation directory path of java would be "/usr/lib/jvm/jdk-15.0.1/". So, make a note of it, as it will be required to set up a Java_HOME variable.

How to set "JAVA_HOME" variable in Ubuntu 20.04

Set JAVA_HOME variable for all users in Ubuntu by editing environment file.

Step24

Edit /system/environment file

$ sudo vi /etc/environment

Add path "/usr/lib/jvm/jdk-15.0.1/bin" to the last of the environment file. Then, save and exit.

how-to-set-java-home-in-ubuntu

Run source command to execute changes made in environment file.

$ sudo source /etc/environment

Step25

Check your java version

$ sudo java -version
check-java-version-ubuntu

Remove java runtime environment package using dpkg command

Step26

Run dpkg command with --purge option to completely clean java from Ubuntu 20.04

$ sudo dpkg --purge "package-name"

For example,

$ sudo dpkg --purge jdk-15.0.1
remove-java-runtime-environment-completely-dpkg-command

Video Tutorial - JRE error solved for Ubuntu

Video on "How to fix java runtime environment error in Ubuntu 20.04"

How to Fix “Java Runtime Environment not found” error
Frequently Asked Questions (FAQs)

Where is java runtime environment on Windows 10?

Default installation folder for java runtime is "C:\Program files\java\jdk-15.0.1\bin" in case of windows 10.

What does Java Runtime Environment do?

Java Runtime Environment (JRE) helps to run java programs like the eclipse.

What is java runtime environment used for?

Java runtime environment helps to run java programs like Tomcat, eclipse and Jenkins.

What is java runtime environment?

Java runtime environment JRE is a software runs on the operating system. Which provides class libraries and resources to run java programs.

How to set java runtime environment in windows 10?

Type "environment" in the search window. Click "open" on "Edit the system environment variables"
Click on Environment variables.
Select "Path" > Then click Edit.
Select New > Give path of java installation directory > For example, "C:\Program files\java\jdk-15.0.1\bin"
Click OK

Ending notes

I hope after reading this article, you will be able to solve "Java Runtime Environment not found error". Because majorly reasons for java related errors are, either Java is not installed or java variable is not set.

if you still have issues, please comment and let me know, i will try to help you.

2 thoughts on “How to Fix "Java Runtime Environment not found" error {Windows 10 and Ubuntu 20.04}”

  1. Unable to locate the Java runtime.
    Error details: The operation completed successfully.

    Filename on disk: jdk-16.0.1
    Path: C:\Program Files\Java\jdk-16.0.1
    Exists: Directory\

    I keep getting this message when trying to run mod on minecraft through curseforge

    1. May be due to the conflict with default runtime provided and installed Java runtime on your system. Try deleting the runtime folder from your installation directory. It may fix the issue. "\Local Disk > Program Files (x86) > Minecraft", Delete the runtime folder inside it.
      I hope it helps.

Comments are closed.