Monday, July 26, 2021

How to Fix Eclipse No Java Virtual Machine was found Windows JRE JDK 64 32 bit Error? Example

One of my readers was installing Eclipse in his Windows 7 x86 machine and emailed me about this error "A java Runtime Environment (JRE) or Java Development kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found". Before getting into details and trying to find root cause and solution of Eclipse Java Virtual Machine not found error, let's see some background about Eclipse. Eclipse is a popular Java IDE, which assists on coding, debugging and running Java program, but the key point is, Eclipse itself need Java to launch and run.

By default, Eclipse scans your PATH and looks for any JRE if it founds suitable JRE then it runs otherwise it throws "A java Runtime Environment (JRE) or Java Development kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found". Now, In order to install JRE, you can either download JDK or a JRE from Oracle's Java download site. 

For Java programmers, I suggest installing JDK because it comes with bundled JRE.  Once you install JDK, its good to set your JAVA_HOME environment variable, and subsequently include JAVA_HOME/bin into your PATH. JAVA_HOME contains "java" command-line utility which is what required by Eclipse to run. 

Alternatively, you can install JRE on your windows 7 machine, and include its bin directory into PATH that contains javaw command, which can also run Eclipse or any Java program. By the way, there is a subtle difference between java and javaw, which is worth knowing. 

You can get "No Java virtual machine was found" error during fresh install or reinstalling Eclipse, but root cause always lies in PATH which is quite obvious with the error itself. Here is how this virtual machine not found error looks in Eclipse.



x86 and x64 Eclipse, JRE, and Windows confusion

Things get more complicated with the increased popularity of 64-bit machines and x64 operating Systems like Windows 7 x64. Many of us know that 64-bit JVM allows you to set a larger heap size than 32 bit JVM, but from a normal user perspective, it adds more confusion. Now both Eclipse and Java is available for x86 and x64 architectures for Windows. 

Since many programmers think that same Java runs on multiple operating systems e.g. Windows 8, Windows 7, Windows Vista, Windows XP or Windows Server 2008, Instead of downloading the correct version of JDK they simply use the one they have earlier, potentially 32 bit JRE, or copied version of JDK or JRE which could also be potentially x86 JRE. So if you are running a Windows 7 x64 or Windows 8 desktop, you better download 64 bit JRE e.g. jre-7-windows-x64.exe or x64 JDK jdk-7u11-windows-x64.exe from http://www.oracle.com/technetwork/java/javase/downloads/


No Java virtual machine was found Eclipse JRE

Once you have correct JDK or JRE, and Eclipse i.e. either all x86 or all x64, all remains is setting PATH for Java. Once you set PATH just open a command prompt windows and type echo
%PATH% and check if it correct JRE or JDK is included in PATH. 

By the way, if you have installed both 32 bit and 64 bit JDK than you should be careful which JDK or JRE comes first in PATH because any Java program including Eclipse will pick the JRE which comes earlier in PATH.

 This also applies if you are running Eclipse in Linux operating system, you need to ensure whether Linux is x86 or x64 and subsequently download x86 or x64 Eclipse and JDK or JRE. By the way, If you are confused between these two, read the difference between JDK and JRE.

Steps to troubleshoot Eclipse No Java Virtual Machine was found an error

Eclipse No Java Virtual Machine was found Windows JRE JDK 64 32 bit ErrorHere is a couple of things you can check in order to troubleshoot and fix Eclipse No Java Virtual Machine was found an error. As error suggests, Eclipse is not able to find any JVM which comes with either JDK or JRE installation, and most likely you need to modify your PATH to fix this issue.

1) Find out whether you are running on x32 or x64 Windows or Linux operating systems.

2) Check if you have JRE or JDK installed in your machine or not. If not then install correct JDK or JRE i.e. x86 or x64 JDK and JRE.

3) Check whether JRE or JDK is in your system PATH or not. If you are unsure than see this article to set PATH for Java in Windows and Linux

4) Check if both JRE and Eclipse come as 32 bit and 64-bit flavor. If you are running on 64 bit Windows operating system e.g. Windows 7 x64  and trying to install Eclipse 64 bit version, than you need a 64 bit JRE or JDK.

5) Alternative if you are running on 32 bit Windows operating system e.g. Windows 7 x86 or Windows XP than you need to use 32 bit Eclipse and 32 bit JDK or JRE version to launch Eclipse.

6) If you have multiple JDK and JRE installed in your machine, and your PATH contains location to those JDK and JRE, than Eclipse will pick the first one from PATH. This can create issues if you are running 64 bit Eclipse, and 32 bit JDK comes earlier in PATH of your windows 7 machine.

That's all about error "A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found". Apparently, this is a simple error to fix, but when it comes especially when you have JDK and JRE installed and have included them in PATH, it becomes tricky and creates confusion among users. Let us know if you have faced "Eclipse: No Java virtual machine was found" error before and how did you fix it.


Other Java Eclipse articles you may like to explore
  • 30 Useful Eclipse Shortcuts for Java Developers (list)
  • How to remote debug Java application in Eclipse? (tutorial)
  • 10 Eclipse debugging tips Java developer should know? (see here)
  • How to attach source code for JAR file in Eclipse? (guide)
  • Eclipse shortcut to print System.out.println statements? (shortcut)
  • How to increase console buffer size in Eclipse? (steps)
  • How to use spaces instead of tabs in Eclipse? (guide)
  • How to create an executable JAR file from Eclipse? (example)
  • 3 Books to Learn Eclipse IDE for Java developers (list)
  • How to Increase Heap Size of Java Program running in Eclipse? (guide)

Thanks for reading this article so far. If you like this article then please share with your friends and colleagues. If you have any questions or feedback then please drop a comment.

10 comments :

Anonymous said...

I have this error and am tired of just trying to get eclipse to work so that I can build an app. Seems that there must be another way, since I have read so many pages on how to fix this and none of them work. Already 3 days trying to get eclipse to open. Is there just another way to build an app without this inferior product called eclipse?

Unknown said...

I am still getting erro as "Could not find Java SE runtime environmet" following with a window saying many points My Path variable is set bin dir as stated by you and also i checked in CMD n its all correct.

Kindly guide me.

javin paul said...

Hello Rohini, Are you using 64-bit Operating System e.g. Windows 7 or Windows 8.1, please check whether JRE, JDK, Windows and Eclipse are all 32-bit or 64-bit or not. This has caused lot of problem in past.

Yadunath.T.R said...

hello all.. i had the same problem of java error by eclipse. i solved the problem by downloading the jre latest version (64 for me as my eclipse and the OS are 64). installed it in eclipse folder. then run the eclipse.exe. it worked fine..

Unknown said...

I was facing no java virtual machine was found error since long. Thank you for the solution.

queenofslime said...

Eclipse was working perfectly for me, but then I changed my PATH to download something, and then i started getting this error. I've changed my path back to what it was before, but it still doesn't work. I don't understand what's wrong with it. :(

Cameron said...

For me the problem was just an incorrect -vm flag in the eclipse.ini file. When I pointed this flag to the correct installation, it all worked fine. I wrote a little tutorial on my experience for anyone interested:

https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/How-to-fix-the-Eclipse-No-Java-virtual-machine-was-found-install-error?poster=me

Anonymous said...

I was also facing the same issue. Everything was up to date but eclipse was giving same error. Then found, it was -vm flag, set to old javaw.exe path, as I changed it, eclipse started working.

Unknown said...

So thankful to you!I was facing the same problem since 2 days.Thanks for helping me out of this :)

javin paul said...

@Unknown, happy that it helped you.

Post a Comment