Monday, April 29, 2013

Eclipse No Java Virtual Machine was found Windows JRE JDK 64 32 bit Error

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 key point is, Eclipse itself need Java to launch and run. By default, Eclipse scans your PATH and look 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 to install 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 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 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 e.g.. Windows 7 x64. Many of us know that 64-bit JVM allows you to set larger heap size than 32 bit JVM, but from a normal users 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 system e.g. Windows 8, Windows 7, Windows Vista, Windows XP or Windows Server 2008, Instead of downloading 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

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 difference between JDK and JRE.

Steps to troubleshoot Eclipse No Java Virtual Machine was found error

Eclipse No Java Virtual Machine was found Windows JRE JDK 64 32 bit ErrorHere is couple of things you can check in order to troubleshoot and fix Eclipse No Java Virtual Machine was found error. As error suggest, 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 system.
1) Check if you have JRE or JDK installed in your machine or not. If not than install correct JDK or JRE i.e. x86 or x64 JDK and JRE.

2) 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
3) Check if both JRE and Eclipse comes as 32 bit and 64 bit flavour. 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.

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

5) 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 abour 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 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 create confusion amoong users. Let us know if you have faced "Eclipse : No Java virtual machine was found" error before and how did you fix it.

Further Learning
The Eclipse Guided Tour - Part 1 and 2
Java Fundamentals, Part 1 and 2
The Java Developer's Guide to Eclipse

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.


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?

Rohini.M Gangadhar 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..

Nevil patel said...

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

Post a Comment