Updating Java Breaks Eclipse Running - java

I just updated Java because I got a notification to do so. Now, whenever I try to run something in Eclipse, I get an error: Unable to locate executable for jre1.8.0_20. From my understanding, I should be able to keep the old installation of Java and just point Eclipse at the jre. Is my understanding incorrect? How do I fix this problem?
java -version returns java version "1.8.0_25"

While the other two answers are technically correct here is slightly more detail.
In your eclipse.ini file (which should be in the same directory as where you installed eclipse) add the lines
-vm
C:/path/to/java/jdk1.8.0_20\jre\bin\javaw.exe
Then save and reopen eclipse

In eclipse.ini file use -vm to point javaw.exe file with entire path, where it is available.

I had the exact same problem. After looking at this answer: Eclipse returns error message "Java was started but returned exit code = 1" the key for me was to move the -vm line above the -vmargs entry in the eclipse.ini and to point it to bin\server\jvm.dll instead of bin\javaw.exe

look in the eclipse.ini file, that's where it specifies the JVM to run with.

As you didn't tell us which version of eclipse are you using, the way that I solve this problem is to
remove the line in eclipse.ini file:
-Dsun.lang.ClassLoader.allowArraySyntax=true
This worked for me (eclipse-jee-luna-R-win32-x86_64.zip).

Related

intellij idea failed to create JVM error code -1

I have intellij-idea installed. Although I have set JAVA_HOME environment variable referring to "C:\Program Files\Java\jdk1.8.0_45" but when I try to run it, I end up with the following error:
failed to create JVM: error code -1. JVM path: "C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.2\jre64\" if you have a 64-bit jdk installed, define a JAVA_HOME variable in Computer> system variables> system settings> environment variables.
Windows 7_ 64-bit
My workaround was to go to C:\Users\{username}\AppData\Roaming\JetBrains\IntelliJIdea2020.3\idea64.exe vmoptions file and delete the whole content. The error disappeared and IntelliJ started normally.
Note that there are 2 .vmoptions files. There is the one in the bin directory and an override in
%HOMEPATH%\IntelliJIdea\config
For me the answer was to remove -Xmx and -Xms options from the override file.
Please check your phpstorm64.exe.vmoptions file located at bin folder and remove option
-XX:+UseG1GC
it is not a JAVA_HOME issue, you no doubt have touched the *.vmoptions files in bin folder. if you have entered the licence sever in the *.vmpotions file, notice that it should be like this "-javaagent:C:\Program Files....." don't forget to include "-javaagent:" at the beginning of the license server ;)
The file may be corrupted after a bad manipulation.
Just copy and paste the idea{64}.exe.vmoptions from
%IntelliJ installation path%/bin to %User IntelliJ data path%/config.
For example :
Copy "C:/Program Files/JetBrains/IntelliJ IDEA 2019.2.3/bin/idea64.exe.vmoptions" and paste into "C:/Users/HP/.IntelliJIdea2019.2/config"
I've been using IntelliJ for some time and this issue popped up sometime ago for me too. The issue is with a "VMOPTIONS" file. C:\Users\UserName\AppData\Roaming\NetBeans Go to this location and inside you'll find a VMOPTIONS file. Delete it. Now run the Application and it should work. This VMOPTIONS file is infact a copy of the original VMOPTION file located else where but which can also override the default VMOPTIONS. So deleting this copy with some invalid options inside fixes the problem.
If a VMOPTIONS file doesn't exist in the above path, Go to this location C:\Program Files\JetBrains\IntelliJ IDEA Community Edition xxxx.x.x\bin and run the idea.bat file. Not the exe file. This should fix any and all other problems and let you open the application with out getting that error.
You might have the JRE_HOME environment variable set in your system. Remove that and try again. It generally overwrites the JAVA_HOME variable.
I am just copy file "phpstorm64.exe.vmoptions" from C:\Program Files\JetBrains\PhpStorm 2019.3.1\bin and paste it(replace) in C:\Users\{{your username}}\.PhpStorm2019.3\config
It works fine for me..
I got such error when adding JAVA_TOOL_OPTIONS in environment variables. Try to rename this variable to JAVA_OPTS restart IDE and rename again to JAVA_TOOL_OPTIONS. Or simply delete JAVA_TOOLS_OPTIONS if it is not required
You can find default vmoptions file of windows 64bit version of it in :
C:\Users{user}\AppData\Roaming\JetBrains\PhpStorm..\phpstorm64.exe.vmoptions
You can reinstall phpstorm as well ,it's quick.
I simply removed JAVA_HOME from system variable then again added and saved.
Restart IntelliJ again. Worked fine for me.
It works fine with Webstorm
JAVA_HOME. Watch this tutorial
Delete .vmoptions file. It contains in:
C:\Program Files\WebStorm 2021.3\bin
C:\Users\%USER%\AppData\Roaming\JetBrains\WebStorm2021.3 OR C:\Users\%USER%\.somewhere
I had added
-T 6C clean install -Dmaven.test.skip=true lines. Then I removed them, program is working now.
try to launch idea64.exe from the cmd and see if it works

How To Change An Association With A .jar File? [duplicate]

I just created a jar file using jdk7. I tried running it but kept getting an error. It turned out it was pointing at a jre6 and not the jre in jdk7. So, I used the following command to change it
ftype jarfile = "C:\path to jre\bin\javaw.exe" -jar "%1" %*
After that, I tried to double click on my jar file again, but it popped up a window asking me to choose a program to open it with. When I chose the same javaw.exe file as above it runs but exits immediately without doing anything. I can run it fine in cmd by doing the java -jar file.jar command. I even tried deleting the .jar registry key, but that just got me back to the point where it asked me to choose a program to open with. I'm running windows 7 ultimate if that matters.
EDIT:
In the registry there are 3 subkeys: OpenWithList, OpenWithProgids, and UserChoice. I've changed all the defaults to the path above except UserChoice which won't let me edit it from regedit. When I delete that and try to run the jar file, it opens up the choose a program to open with window again. For some reason it ignores the other registry keys
OK, I found the answer somewhere else but ran into this issue again so came here via google.
The solution is...
Open up regedit.exe
Either search for "jre6" or follow this: HKLM->SOFTWARE->Classes->jarfile->shell->open->command
Change the Data field to the directory of the javaw.exe file that's in your JDK directory.
For the love of God, don't forget to put the weird [-jar "%1" %*] parts on the end of it.
Enjoy outsmarting Oracle.
Hopefully this'll save some people a bit of time.
This happened to me when I installed the JRE6 plugin for Chrome, though it could happen when installing any other JRE I guess.
I fixed it by going to regedit and searched for jre which brought up...
HKEY_CURRENT_USER/Software/Classes/Applications/javaw.exe/shell/open/command
I changed the REG_SZ
from: "C:\Program Files (x86)\Java\jre7\bin\javaw.exe" "%1"
to: "C:\Program Files (x86)\Java\jre7\bin\javaw.exe" -jar "%1" %*
When windows asks you for a program to run it against it won't insert the needed -jar argument in the command line.
If it's asking you for the exe in which to run it then that means somehow your JRE isn't associated with the .jar extension. You'll need to modify the .jar file registry entry so that it runs c:\path_to_jre\bin\javaw -jar %1 in order for it to work.
It used to be under File Explorer > Tools > Folder Options > File Types.
Then look for .jar in there. You should find a text field that shows the executable to run and the command line arguments. That's what you want to modify. You can also do it in the registry editor too, but I've forgotten the HKEY variable path. I'm sure this KBA will help:
support_microsoft_kb_950505
Check if the file type jarfile is actually registered with the *.jar extension using
assoc .jar
Seems like .jar is not linked to jarfile.
I'm not sure exactly why none of the solutions worked, but I reinstalled jre7 and it works now.
Isn't it easier to change your java version to you rnew jdk7 by changing the CLASSPATH environment variable? See how here

Cannot start Eclipse - Java error

Eclipse (Indigo) suddenly stopped working, giving the rather well-known error when trying to start it:
Java was starte but returned exit code=1
...
I've tried adding this to the eclipse.ini file:
-vm
C:\Program Files\Java\jdk1.7.0_03\jre\bin\server\jvm.dll
just before the -vmarg line.
This gets rid of the error message, but now there's just a short glimpse of the eclipse startup image, then it disappears. And eclipse doesn't start, of course.
As mentioned, this suddenly happened, without any changes to eclipse or the java installation. When the problem occured, I finally accepted the annoying Java update nag screen and installed the update.It didn't help at all.
Any ideas?
EDIT: I noticed in the eclipse.ini file these lines:
-vmargs
-Dosgi.requiredJavaVersion=1.5
I tried changing the version to 1.7, and even removing the two lines alltogether. Still the error message.
Here's the complete error message:
Try replacing the backslashes with regular slashes. My eclipse.ini looks like this:
-vm
C:/Program Files/Java/jdk1.7.0_45/bin
Eclipse requires JDK bin as the virtual machine. Give path to javaw.exe as -vm argument.
my -vm argument looks like this
-vm C:/Program Files/Java/jdk1.7.0_55/bin/javaw.exe
As you were saying this suddenly stopped working, there must be some change to JAVA_HOME or related PATH variables in your environment configuration which would have removed reference to JDK home.
Add the -vm argument to the eclipse.ini file like you did earlier, make sure you give the path to the java or javaw.exe and put the path in "" like this
"C:\program files...." when your path has spaces

VisualVM running JRE

I can't get VisualVM working with eclipse, i was following these instructions
http://visualvm.java.net/download.html
and also these
http://visualvm.java.net/gettingstarted.html
The problem is that it cant see JDK location which is "C:\Program Files\Java\jdk1.8.0_05", this happens when i try to run the application
Here is the original content of visualvm.conf file
http://pastebin.com/K9TnQb0G
Unfortunately my command line is somehow broken too(or I'm the one who dont know how to do it)
First I tryed to install JProbe but it wasnt working, then I tryed VisualVM and it also isn't working. How can i resolve this please? I wasted 5 hours and its driving me crazy.
Uncomment line 72 of your visualvm.conf file, and set the value:
#visualvm_jdkhome="/path/to/jdk"
For MAC users, add below line to visualvm.conf file which can be located at /Applications/VisualVM.app/Contents/Resources/visualvm/etc
visualvm_jdkhome="/Library/Java/JavaVirtualMachines/<jdk version>/Contents/Home"
Add the JDK bin directory to the PATH environmental variable
PATH=C:\Program Files\Java\jdk1.8.0_05\bin;%PATH%
For windowss its as simple as this:
<YourVisualVMUnzippedDir>\visualvm.exe --jdkhome "C:\YourPathToJDKDirForExample\Java\jdk1.6.0"
Source: https://visualvm.github.io/gettingstarted.html

Eclipse is not opening

I'm new to java and eclipse. I even saw this type of query on this website. But I have applied all those methods and it was also helpful. But when I try to open eclipse, it is not opening:
This is my path for java
C:\Program Files (x86)\Java\jre6
this is where my eclipse is
C:\Users\New folder\eclipse
But when I run the eclipse I'm getting an error
"A java rumtime 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 location: C:\Users\New
folder\eclipse\jre\bin\javaw.exe javaw.exe in your current path"
Please tell me the possible solution.
Thanks in advance!
If you have installed jdk then Eclipse won't have any issue to start. I think you just have installed JRE to run java programs. You need to install JDK.
To check whether you have installed JDK. Check Path C:\Program Files (x86)\Java. Your Java directory should contain directory jdk1.6.., If you don't have this directory there, search it at other places. If you did not find directory then you didn't install JDK.
Download JDK from here.
You should set JAVA_HOME and JRE_HOME variable. http://www.javawebonline.com/java-se-programming/beginners/java_home-jre_home-environment-variables/
And another suggestion is you should move your java home to another location and test your path to java such as
C:\Java\jre6
instead of
C:\Program Files (x86)\Java\jre6.
Go to C:\Users\New folder\eclipse
Open eclipse.ini file with text editor and add the javaw location there
( right after -vm part ) like so:
-vm
C:/Program Files/Java/jdk1.6.0_33/bin/javaw.exe <--- change to your path
-vmargs
Open the command prompt by pressing Windows+r, type cmd and press Enter.
Type javac and check the output.
If it gives all the options and usage, then you have configured the PATH vairables correctly, or else you have not set them up correctly.
Try it by checking the value at the command prompt.
NOTE
You need to open a new command prompt each time you change the environment variables.
If you have two Program Files folder in your C: drive
such as
C:\Program Files
C:\Program Files (x86)
then try to put your java inside
C:\Program Files
instead of C:\Program Files (x86)
It seems you are running 64 bit eclipse in 64 bit operating system. If you are running 64 bit eclipse then you need 64 bit JDK. Please install 64 bit JDK and run eclipse.

Categories

Resources