[java] Eclipse will not open due to environment variables

I just rebooted my computer without changing anything. Suddenly I can't open Eclipse. Instead, I get this error message:

+----------------------------------------------------------------------+
¦ Eclipse                                                              ¦
+----------------------------------------------------------------------¦
¦                                                                      ¦
¦   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:                 ¦
¦   C:\Users\emiri\Downloads\eclipse\jre\bin\javaw.exe                 ¦
¦   javaw.exe in your current PATH                                     ¦
¦                                                                      ¦
¦                                                      +------------+  ¦
¦                                                      ¦     OK     ¦  ¦
¦                                                      +------------+  ¦
+----------------------------------------------------------------------+

And I see all my environment variables have been erased. java, javac, mvn, etc. don't work. What do I do now, and how do I fix this?

This question is related to java eclipse environment-variables

The answer is


Let eclipse use your java vm directly!

Put these lines at the end of eclipse.ini (located in the directory where eclipse.exe is present):

-vm
<your path to jdk|jre>/bin/javaw.exe

Pay attention that there are two lines. Also make sure that the -vm option is before the -vmargs option (and of course after "openFile").

Useful link Eclispe.ini at wiki.eclipse.org


First uninstall all java software like JRE 7 or JRE 6 or JDK ,then open the following path :

START > CONTROL PANEL > ADVANCED SETTING > ENVIRONMENT VARIABLE > SYSTEM VARIABLE > PATH

Then click on Edit button and paste the following text to Variable_Value and click OK.

C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\

Now go to this url http://java.com/en/download/manual.jsp and click on Windows Offline and click on run and start again eclipse.

Enjoy it!


Copy jre folder present in "C:\Program Files\Java\" directory into eclipse folder.. i.e, C:\eclipse\


very easy, you just copy the folder 'jre' to the folder that you put eclipse. That'all. Jre is the environment, normally it's location in the C:/Programing Files/Java/jre :D


-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130807-1835
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
**-vm
C:/Program Files (x86)/Java/jdk1.7.0_45/bin/javaw.exe** =>false
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
-vm
C:\Program Files (x86)\Java\jdk1.7.0_45\bin\javaw.exe

Another alternative is to re-run the JRE setup. It typically installs a default JRE by placing java.exe, javaw.exe, etc. in your system folder. That would place the executables in your path, which should be sufficient, based on the note in the error message that it searched your path for javaw.exe


Ok...Ok... Don't worry i am also ruined by this error and fatal and when i got it i was so serious even i was not giving an attention to other work, but i got it, Simply first of all copy this code and paste in your system variable Under path ...

C:\Program Files;C:\Winnt;C:\Winnt\System32;C:\Program Files\Java\jre6\bin\javaw.exe

Now copy the "jre" folder from your path like i have have "jre" under this path

            C:\Program Files\Java

and paste it in your eclipse folder means where your eclipse.exe file is placed. like i have my eclipse set up in this location

    F:\Softwares\LANGUAGES SOFTEARE\Android Setup\eclipse

So inside the eclipse Folder paste the "jre" FOLDER . If you have "jre6" then rename it as "jre"....and run your eclipse you will got the solution...

   //<<<<<<<<<<<<<<----------------------------->>>>>>>>>>>>>>>>>>>                 

OTHER SOLUTION: 2

If the problem could't solve with the above steps, then follow these steps

  1. Copy the folder "jre" from your Java path like C:\Program Files\Java\jre6* etc, and paste it in your eclipse directory(Where is your eclipse available)
  2. Go to eclipse.ini file , open it up.
  3. Change the directory of your javaw.exe file like

-vmF:\Softwares\LANGUAGES SOFTEARE\Android Setup\eclipse Indigo version 32 Bit\jre\bin/javaw.exe

Now this time when you will start eclipse it will search for javaw.exe, so it will search the path in the eclipse.ini, as it is now in the same folder so, it will start the javaw.exe and it will start working.

If You still have any query you can ask it again, just go on my profile and find out my email id. because i love stack overflow forum, and it made me a programmer.*


Eclipse and Java JDK (or JRE) must match regarding the BIT Version

For example:

32 Bit Eclipse won't work with 64 Bit Java!

32 Bit Eclipse needs 32 Bit Java!


java problems solved when I updated my 64bit Java (i'm using 64bit W7 & 64bit eclipse 4.4.0):

http://www.java.com/en/download/manual.jsp

Recommended Version 7 Update 67 Windows Offline (64-bit) filesize: 29.5 MB


It may be bacause you do not have jre installed. Thus go to http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html and download it.


I think I found an easier way (for me anyway). Locate your javaw.exe file (either by searching for it or just where you installed it), then drag the javaw.exe file onto the eclipse.exe file and it will use it.


You should install both 32bit & 64bit java (At least JRE), that in case you're using 64bit OS.


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to environment-variables

Using Environment Variables with Vue.js Adding an .env file to React Project Is there any way to set environment variables in Visual Studio Code? Test process.env with Jest How to set environment variables in PyCharm? ARG or ENV, which one to use in this case? how to set ASPNETCORE_ENVIRONMENT to be considered for publishing an asp.net core application? What is a good practice to check if an environmental variable exists or not? Passing bash variable to jq Tensorflow set CUDA_VISIBLE_DEVICES within jupyter