Installing Eclipse without changing the PATH env variable - eclipse

Is it possible to specify the jvm that the eclipse installer will use? I'm getting the error "Version 1.7.0_67 of the JVM is not suitable for this product. Version: 1.8 or greater is required".
I want to install eclipse oxygen and I have jdk 8, but I don't want to mess with the PATH environment variable that is currently pointing to jre 7, because I fear it may confuse other programs. Is there any way to do this?
Update:
I tried creating an eclipse-inst.ini file as suggested and placed it in the same directory as the installer (note, I didn't edit anything, since there was no existing file).
Tried a number of options for the second line (of course not all at the same time like below):
-vm
C:/zIMC/imc-dev-1.8/jdk8/jre/bin/javaw.exe
C:/zIMC/imc-dev-1.8/jdk8/bin/javaw.exe
C:/zIMC/imc-dev-1.8/jdk8/bin/java.exe
C:/zIMC/imc-dev-1.8/jdk8/bin/
C:/zIMC/imc-dev-1.8/jdk8/jre/bin/server/jvm.dll
Also tried most of them with backslash instead. The last one is from the eclipse.ini of my old installation, which is using jdk7. None of them works, all still give exactly the same message then the installer is run.

I faced the same issue
Download zip version of eclipse,
Once deployed open text file at root folder eclipse.ini
Add the following lines:
-vm
C:/java/jdk1.8.0_144/jre/bin (put correct path for your jvm here)
I added the lines after --launcher.appendVmargs , but i am not sure if that makes any difference.

Related

Force the -vm entry in the eclipse.ini to stay as relative path?

There was a bug where after installing plugins the -vm entry got messed up. This is a bit similar, on every run the relative path will get resolved into an absolute path. I would like to keep the eclipse portable and this is the last part required to make this happen. When the path gets resolved into absolute it again is not portable. Is there a way to stop eclipse from resolving the -vm entry? Or disallow touching the INI file at all?
If not I will have to use separate cmd to start the eclipse or use a shortcut and feed the -vm that way.
Thank you in advance for any hints.
Edit: The desire is to have portable Eclipse with bundled JRE and have it working even when it's moved around.
No exact answer to your question, but to get a portable Eclipse IDE or an Eclipse-based application, a JRE/SDK can be embedded in the subfolder jre instead of using -vm in the .ini file.

Cannot launch multiple instances of Eclipse Juno

I have multiple Eclipse versions installed in different locations (F:/eclipse-indigo, F:/eclipse-ganymede, F:/eclipse-juno). Indigo and ganymede allow me to launch multiple instances as long as I choose a different workspace. When launching a second instance of Juno I get the error stating "Java was started but returned exit code=1".
I've search for the error but most solutions were for OP not being able to launch Juno at all.
I can launch one instance fine but the second instance doesn't even allow me to choose a different workspace.
Just the error message above.
Try in this order:
Update your Java installation to a recent version. There are bugs in older Java versions causing similar problems: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7002666
Explicitly set the -vm argument in eclipse.ini to point to the Java installation that you want to use (in case there are multiple). Your Eclipse installation currently uses whatever Java was last installed (as that one copied itself into the system32 folder, from where it is started according to the error message).
Compare the eclipse.ini of Juno and one other version. Ignore the DLL and file names, but look if you changed some of the vm options (like memory size) in your old installation. If so, copy those settings into your Juno eclipse.ini.
Have you tried to start Juno explicitly by giving the workspace as argument like in the following shortcut:
F:\eclipse-juno\eclipse\eclipse.exe -data F:\eclipse-juno\ws1
If that does work, there is something wrong (in Juno) with selecting the workspace at the beginning. I try all the time to be explicit with which workspace I want to run Eclipse by creating a batch file or shortcut command like the above.
See this answer for typical command line options.

How to change default JRE for all Eclipse workspaces?

I have one JRE in C:\Program Files (x86)\Java\jre6 and that was the only one at the time I installed Eclipse. I have subsequently installed a complete JDK in C:\home\SFTWR\jdk1.6.0_21 and changed my JAVA_HOME environment variable to that. However, every time I start a new Eclipse workspace, it only picks up the old JRE and I have to manually remove it and add the new one.
How do I bind my Eclipse install to the new JDK so that every new workspace points to that only? I checked eclipse.ini but there was no reference there to which JRE to go to.
UPDATE:
I went into Prefs->Java->Installed JREs, added the new location, marked it as default, removed the other, and it was effective only for the current workspace. However, when I opened a new workspace, only the old JRE was available. So this didn't change the core Eclipse config that is applicable across all (at least new) workspaces
Finally got it: The way Eclipse picks up the JRE is using the system's PATH.
I did not have C:\home\SFTWR\jdk1.6.0_21\bin in the path at all before and I did have C:\Program Files (x86)\Java\jre6\bin. I had both JRE_HOME and JAVA_HOME set to C:\home\SFTWR\jdk1.6.0_21 but neither of those two mattered. I guess Eclipse did (something to the effect of) where java (or which on UNIX/Linux) to see where Java is in the path and took the JRE to which that java.exe belonged. In my case, despite all the configuration tweaks I had done (including eclipse.ini -vm option as suggested above), it remained stuck to what was in the path.
I removed the old JRE bin from the path, put the new one in, and it works for all workspaces.
The Installed JREs is used for what JREs to execute for your downstream Java projects and servers. As far as what JVM or JRE that is used to execute Eclipse process (workbench) itself that is controlled by your environment, history and eclipse.exe binary. So eclipse.exe itself decides what JRE Eclipse will execute itself with, not installed JREs preferences since those are not read until OSGi framework is up and running which is loaded after the JVM/JRE is picked.
So for new workspaces, Eclipse is going to use its currently executing JRE to populate the JRE prefs.
The best way I know how is to force eclipse.exe to use the JRE that you tell it via the -vm switch. So in your eclipse.ini do this:
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-vm
/path/to/exactly/what/jre/you/want/as/default/javaw.exe
...
Open the Java > Installed JREs preference page. Check the box on the
line for the JRE that you want to assign as the default JRE in your
workbench. If the JRE you want to assign as the default does not
appear in the list, you must add it. Click OK.
Source-http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-assign_default_jre.htm
In eclipse go to
Window-> Java -> Installed JREs
You can remove your current installed jre and add the jdk by specifying the path to where the jdk is installed.
I ran into a similar issue where eclipse was not using my current %JAVA_HOME% that was on the path and was instead using an older version. The documentation points out that if no -vm is specified in the ini file, eclipse will search for a shared library jvm.dll This appears in the registry under the key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment that gets installed when using the windows java installer (key might be a bit different based on 64-bit vs 32-bit, but search for jvm.dll). Because it was finding this shared library on my path before the %JAVA_HOME%/bin, it was using the old version.
Like others have stated, the easiest way to deal with this is to specify the specific vm you want to use in the eclipse.ini file. I'm writing this because I couldn't figure out how it was still using the old version when it wasn't specified anywhere on the path or eclipse.ini file.
See link to doc below:
http://help.eclipse.org/kepler/topic/org.eclipse.platform.doc.isv/reference/misc/launcher.html?cp=2_1_3_1
Finding a VM and using the JNI Invocation API
The Eclipse launcher is capable of loading the Java VM in the eclipse process using the Java Native Interface Invocation API. The launcher is still capable of starting the Java VM in a separate process the same as previous version of Eclipse did. Which method is used depends on how the VM was found.
No -vm specified
When no -vm is specified, the launcher looks for a virtual machine first in a jre directory in the root of eclipse and then on the search path. If java is found in either location, then the launcher looks for a jvm shared library (jvm.dll on Windows, libjvm.so on *nix platforms) relative to that java executable.
If a jvm shared library is found the launcher loads it and uses the JNI invocation API to start the vm.
If no jvm shared library is found, the launcher executes the java launcher to start the vm in a new process.
-vm specified on the command line or in eclipse.ini
Eclipse can be started with "-vm " to indicate a virtual machine to use. There are several possibilities for the value of :
directory: is a directory. We look in that directory for:
(1) a java launcher or
(2) the jvm shared library.
If we find the jvm shared library, we use JNI invocation. If we find a launcher, we attempt to find a jvm library in known locations relative to the launcher. If we find one, we use JNI invocation. If no jvm library is found, we exec java in a new process.
java.exe/javaw.exe: is a path to a java launcher. We exec that java launcher to start the vm in a new process.
jvm dll or so: is a path to a jvm shared library. We attempt to load that library and use the JNI Invocation API to start the vm in the current process.
My answer will overlap with amphibient's while adding on to it.
Your JAVA_HOME variable is fine, but you also need to append the following to your Path variable :
;%JAVA_HOME%\bin
This will allow your applications in your Windows environment to access your JDK. You should also restart your computer once you've added these environment variables before checking out if they work. In my case, even logging out and then back in didn't work : I had to completely restart.
If you want to check if the environment variables are set correctly, you can open up a command prompt and type >echo %JAVA_HOME and >echo %Path% to see if those variables are working correctly. While snooping around for solutions, I have also run into people claiming that they need to add quotations marks (") around the environment variables to make them work correctly ("%JAVA_HOME%"\bin) if your JAVA_HOME path includes spaces. I thought that this was my case at first, but after doing a full restart my variables seemed to work correctly without quotation marks despite the spaces.
when you select run configuration, there is a JRE tap up next the main tap, select "Workspace default JRE(JDK1.7)".
Be sure to use the jdk in Prefs->Java->Installed JREs ->Execution Environment
I have faced with the same issue. The resolve:
- Window-->Preferences-->Java-->Installed JREs-->Add...
- Right click on your project-->Build Path-->Configure Build Path-->Add library-->JRE system library-->next-->WorkSpace Default JRE
try to change the order:
right click on you project-> BuildPath->Configure...->Order and Export tab -> move jre7 UP.
I navigated to:
Eclipse>Pref>Java>Installed JRE>Search...
2 of them popped up and I checked the latest one. Before I did this I also went to About>Check for Updates and updated it. I didn't have to reinstall any JRE or JDK either. I might have done it a while back, except it was with 1.6 not 1.4. Hope that helps!
On windows I've tried different approaches
- setting JAVA_HOME, JRE_HOME and extending the PATH to point to the desiered jre18 but nothing helped
- disabling the JRE17 in the java control panel didn't helped either
What helped me out was to force eclipse to use the appropriate JRE in the eclipse.ini file e.g.
-vm
C:\java\jdk1.8.0_111\jre\bin\javaw.exe
#Stefan Michev answer also worked for me,
edit eclispe.ini to point to your installed JRE
-vm
C:\Program Files\Java\jdk-18.0.1.1-openj\bin
but to elaborate;
My application server uses JAVA_HOME and thus PATH so I needed Eclipse to pick up another JRE to run (so to be compatible with an installed plugin).
This Eclipse JRE is different than
than setting Window-> Preferences -> Java -> Installed JREs which as you see in the below image, is for building Java projects, so you can have different projects with different JDKs
Eclipse Installed JREs

Unable to start Eclipse -- can't open \Java\jre6\lib\i386\jvm.cfg

could not open C:\Program Files\Java\jre6\lib\i386\jvm.cfg
is the error coming when i am trying to start eclipse ide.
my C:\Program Files has
jdk1.6.0_14
jdk1.6.0_17
jre6
folders.
path is set to
PATH: C:\Program Files\Java\jdk1.6.0_17\bin
what is the problem
i have seen this link but it is not solving my problem
can't find JRE in the JDK
I had similar problem on a Windows machine. I had moved my Java directory from inside "Program Files" (the space in the directory name was giving me trouble) over to c:\
I set all my PATH variables to the new location, restarted the machine and thought that would be enough. Nope
java -- version
Error: could not open `C:\Program Files\Java\jre1.8.0_66\lib\i386\jvm.cfg
This solution came from the good folks over at coderanch
Start regedit (just type "regedit" into the Run program) and work your way down to HKEY_LOCAL_MACHINE > SOFTWARE > JavaSoft
There you will find several different java directories
Java Development Kit
Java Plug-in
Java Runtime Environment
Java Update
Java Web Start
In each directory you'll find different directories for the different version of java (esp. Java Web Start). Open each and every one and you'll see that your old path is still listed. Double click the Name (left column) of the listing and manually type in the new path.
Open a new terminal and type in Java - version and you should be fine.
This problem can show up if you initially install Java in the default location (C:\Program Files) and then later re-install into another location.
The default installation copies java.exe, javaw.exe and javaws.exe to C:\Windows\System32. If you are in this situation and delete these files it will likely solve your issue.
(Thanks to Jay: http://jaykhimani.blogspot.com/2012/09/error-could-not-open-cprogram.html)
Problem: Eclipse Neon error: "C:\Program Files\Java\jre1.8.0xx.xx\jvm.cfg"
Solution Win7 Pro: System Properties > Enviorment Variables > System Variables > Path > Edit > #make sure the current JAVA directory appears first in the path if more than 1 JAVA directory exist.
In the path that follows, I moved "C:\ProgramData\Oracle\Java\javapath" behind the current directory "C:\Program Files\Java\jdk\bin;C:\Program Files\Java\jre\bin" > save
Path
C:\Program Files\Java\jdk\bin;C:\Program Files\Java\jre\bin;C:\apache-maven-3.5.0\bin;C:\ProgramData\Oracle\Java\javapath
I also had this problem and was having trouble finding a solution, but now I did!
If you uninstall your current running jre version and then install higher one you are good to go.
I was using jre1.6 when I had this problem but after installing 1.7 it was solved!
I recently got the same problem on my Windows 7. The issue was that two different paths were specified for Java in the path environment variable. This can be checked as follows.
On the command prompt, run the following command:
> where java
C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe <br/>
C:\Program Files\Java\jdk1.8.0_192\bin\java.exe
The first one was the cause of the issue and removed it from the path.
Eclipse is working now without re-installation.
Note: The environment vars have been as follows always:
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_192
JRE_HOME=C:\ProgramFiles\Java\jdk1.8.0_192\jre
The problem is that your eclipse cant find jre.Just copy and paste your jre folder into eclipse folder and then start eclipse.Delete environment variable.
What worked for me was to go back to the Java webpage and download the Java jre instead of the jdk, since that is what the stupid computer is now looking for. Then open the C: Program Files>Java and make sure you see jre7 instead of jdk.
RS
Have a simpler solution:
Check your PATH. Most likely it is referring to incorrect java.exe. This started happening to me when I installed OS patch. In process of checkpoint etc, PATH got modified. Once I corrected it (using Environment Variables...), it worked immediately.
Try putting below line in your eclipse/STS -STS.ini file
-vm
C:\Program Files\Java\jdk1.8.0_121(your JDK version)\bin\javaw.exe
Put it at the top of the file.
Most probably it will work.
Sometimes putting javaw.exe in eclipse folder also work (where eclipse.exe is there)
This is an old post, but what solved my solution was editing the `eclispe.ini' file to include the correct path to the JDK.
Building off of what Lars answered, I did reinstall Java, so that may have been the source of the issue. Reglardless, this is the solution that worked for me. I did not have to delete any files from C:\windows\system32, however. I merely told eclipse to look in the new Java installation directory.
These docs indicated I needed to specify the path to the VM:
-vm
C:\Java\jdk1.7.0_25\bin\javaw.exe
This problem mainly occurs when we install new jre or jre gets updated automatically since jdk version and jre version are different and path variable i.e. JAVA_HOME contains jdk path with version included in it . Eclipse might be using that to generate the jre path name for the said file.
I did workaround i.e. changed name of jre folder to the older version e.g.
jre1.8.0_191 is after installing update and
jre1.8.0_60 was before update.
I renamed jre1.8.0_191 with jre1.8.0_60 to solve the issue
I had faced similar problem. Environment variable path problem
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_192
Set the Environment variable after going
Control Panel\All Control Panel Items\System and select Advanced System Settings then set Environment Variables
In System Variables add a new variable JAVA_HOME and variable value = C:\Program Files\Java\jdk1.8.0_192, the path of the jdk file in your system.
and %JAVA_HOME%\bin in the path of the system variables.
Hopefully the problem will solve.
After doing this It works fine for me.

JVM terminated. Exit code = -1

I've been using Eclipse for some time already, and I didn't have any problems with it. However, when I tried to generate some javadoc, I found that I didn't have the SDK installed. I installed jdk 6u23, and from then on, Eclipse hasn't been working.
At first it told me it couldn't find a JRE/SDK. After copying and placing the JRE in the Eclipse folder, the error changed to this:
I've searched around for some solutions, and found a few of varying nature. However, none of them seemed to work.
I've tried emptying my eclipse.ini file without success.
Altering some values in eclipse.ini didn't work either.
Installing Java SDK 1.5 didn't work.
Does anyone have other possible solutions?
Update: I tried reinstalling Eclipse, but it didn't fix the problem. I did notice that it's a 32bit version, while I'm running a 64bit system. However, if this were to be the problem, I find it strange that it hasn't been an issue earlier.
Update 2 I've reinstalled both Eclipse and Java once more, and everything works again.
Remove the default value "256m/256M" from the eclipse configuration file (eclipse.ini).
You will find this line just below "--launcher.XXMaxPermSize".
Edit your Environment Variables >> System Variables >> Path to
C:\Program Files (x86)\Java\jdk1.6.0_24\bin;
(NOT C:\Program Files\Java\jdk1.7.0_01\bin;)
it should work
If you have got a problem like that, you should change the path of jre.
Firstly, computer> properties > advance system setting > Environment variables > find "path" under system variables then give the directory of your jre/bin. (for example C:\ Program Files\ java\ jre\ bin)
Perhaps you should reinstall Eclipse. Then you can add the JDK through Windows -> Preferences -> Java -> Installed JREs.
I had similar issue:
Eclipse IDE fail to launch with JVM Terminated. Exit code=-1
One thing that worked for me is to set -Xmx to 256m in eclipse.ini. If that is not good enough for you, you may also try using different JVM module than the one that eclipse uses by default.
If you look in the error dialog in your screen capture, you'll notice that the "-vm" option using "jvm.dll" as JVM. If you change it to use javaw.exe in your JAVA_HOME\bin folder, the problem should go away.
I'm still clueless as to what the difference is between using jvm.dll vs javaw.exe. Maybe jvm.dll is suppose to be used only for light-weight embedded java applet and it can't handle the load brought on by a full stand-alone Java UI software.
I just had the same problem on Windows 7, 64 bit. I reinstalled Java 32 and Java 64, and Eclipse, but it did not fix the problem. I found that in eclipse.ini the Dosgi.requiredJavaVersion was 1.5, so I changed it to Dosgi.requiredJavaVersion=1.6.0_25. In the Environmental variables I added to the PATH %JAVA_HOME%\bin;C:\Program Files (x86)\Java\jdk1.6.0_25\bin.
These changes fixed my Eclipse problem.
In my case the cause was a corrupted eclipse.ini file. I had been editing the file, and accidentally changed -Xmx512m to -Xmx512
First Approach:
I added below lines in eclipse.ini
-vm C:\Program Files(x86)\Java\jre\bin\java.exe
Modified below line in eclipse.ini (changed to 1.6.0_37 from 1.5),
-Dosgi.requiredJavaVersion=1.6.0_37
Deleted JAVA_HOME from environment variables which was pointing to c:\jdk1.6
Now Eclipse is working fine.
Second Approach:
Another way - don't add below line in Eclipse and only modify JAVA_HOME to point to C:\Program Files(x86)\Java\jre,
-vm C:\Program Files(x86)\Java\jre\bin\java.exe
Eclipse should work now.
I added the entry in the Path environment variable to the jdk bin folder and it started working
Path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft Application Virtualization Client;C:\Program Files\Java\jdk1.6.0_18\bin
There could be many possible causes for this error. It could be that compatible mode is not selected in windows 7 , path or eclipse.ini problem.
Please add "-vm" option to the eclipse.ini file available in the same folder as eclipse.exe.
The -vm option should point to the javaw.exe located in your machine, something like the below.
-vm C:\Program Files(x86)\Java\jre\bin\jawa.exe
After adding the above line to eclipse.ini save it. Now clicking eclipse.exe will automatically launch the IDE.
I had the same problem and it turned out to be a problem with 64-bit versions. My solution was removing all my Java programs and reinstalling the 64-bit JRE (I had downloaded the 64-bit Eclipse).
I tried all the solution still didnt find my luck.Lastly i got it resolved by pointing to client jvm.dll in eclipse.ini file
-vm
C:\jdk160_05\jre\bin\client\jvm.dll
I made a series of trials which you may find useful if you face the same and not getting resolved yet
exit-code-1
I resolved it by installing 32 bit JDK and editing eclipse.ini to point to 32 bit jdk . Added -vm C:\Program Files (x86)\Java\jdk1.7.0_71\bin at the end of eclipse.ini file.
Note: I have my JAVA_HOME pointint to 64 bit JDK
There is no need for reinstalling eclipse IDE or changing your environment variables. I had encountered this problem while working on my project I had this issue but I fixed it in no time and it works fine for me.
Before implementing any solution, Check first that you don't have multiple installations of JDK in your system. I have encountered many systems with JDK 1.7 and JDK 1.8. If it is so, simply change your -vm to the alternate jdk
C:\Program Files\Java\jdk1.7.0_60(jdk version you were not using)\jre\bin\client\jvm.dll
and start your eclipse IDE. IT will work but the workspace will not synchronized and the files will not be getting displayed. Just close your IDE and revert to your previous jdk link and Voila It works.
In case you have a single JDK installed in your system. I suggest clearing your CPU Physical memory. It so happens JVM has issues in execution if a lot of memory is utilised. Just go to the Task manager and close any redundant processes.
Hope this helps! Keep Coding :)
I added the new JRE to the eclipse.ini file and updated my PATH. Seemed to work for me.
I had encountered the same type of the popup message when i am opening IDT app in SAP. It has been resolved after reduced below value
Option Name: _JAVA_OPTIONS
value: -Xms512M -Xmx1024M ( Previously -Xmx2048)
If you encounter a problem like this you can get a little more information by using eclipsec.exe from a command-line instead of eclipse.exe. I got this additional info in the dos box:
C:\<...>\Eclipse>eclipsec
Error occurred during initialization of VM
Could not reserve enough space for object heap
So I lowered my -Xmx setting in eclipse.ini from 1024 to 768, which made it work again.
Why this was suddenly necessary I do not know atm, Eclipse has been running fine with 1024m some days ago.
I am able to solve same issue by specify the -vm
C:\Program Files\Java\jdk1.6.0_45\bin\javaw.exe in eclipse.ini.
I have the same error. It might be because your PC was forced to shut down at night.
My solution was go to the path C:\Users\<find your user profile>\AppData\Local\javasharedresources and delete the file inside this folder
You just click on startup on eclipse folder and open the eclipce or right click on startup and click open with last javaw, then you can find solution.
This problem occure in the case, when you are using 64 bit OS on 32 bit motherboard.
Now, it can be resolved easly,
First uninstall 64 bit java and install 32 bit java.
and set environment variable with jdk path.