Pages

Thursday, October 16, 2014

How to fix: "A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations " error while opening Eclipse on Ubuntu

After downloading Eclipse, when we try to run it, we often encounter the 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 after searching the following locations: /path/to/eclipse/jre/bin/java java in your current PATH“. Sometimes, even when we have correct JAVA_HOME set in PATH environment variable, then also this error occurs.

To solve this, you should take following steps:

  1. Set JAVA_HOME in ~/.bashrc file
  2. Set JAVA_HOME in ~/.profile file – In this file you can also place environment variable assignments, since it gets executed automatically by the DisplayManager during the start-up process desktop session as well as by the login shell when one logs in from the textual console.
  3. Set JAVA_HOME in /etc/environment file
  4. Restart your system and then try to run Eclipse again

Happy coding !! 🙂