Cannot start Eclipse - Java error - java

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

Related

Cannot start Eclipse Memory Analyzer (MAT)

I've downloaded MAT from this link and simply extract the zip file to use. Then, when I executed the MemoryAnalyzer.exe, I got this errror
My %JAVA_HOME% is already C:\Program Files\Java\jdk1.8.0_251.
Could you guys help me please?
If you set your JAVA_HOME correctly and it still doesn't work, you can try add below line to the MemoryAnalyzer.ini
-vm
C:\Program Files\Java\jdk1.8.0_251\bin
But remeber to add before -vmargs option.
You can also try to add jvm.dll path directly:
-vm
C:\Program Files\Java\jdk1.8.0_251\bin\server\jvm.dll
Also check this out: https://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example
If using MacOS, make sure you have JVM 11 or above installed and add the following line to MemoryAnalyzer.ini by replacing the JAVA_HOME variable.
-vm
$JAVA_HOME/bin
And make sure this flag is before -vmargs

Eclipse stating that isntall directory is location of JAVA_HOME

I was trying to setup a workspace for modding in Minecraft, and got a error stating that my JAVA_HOME directory was not found. After messing around and installing a new JDK, running Eclipse states that:
"A Java Runtime Enviroment (JRE) or Java Development Kit (JDK)" must be avaiable in order to run Eclipse. No Java virtual Machine was found after searching the following locations: C:\Users\|My Username|\Desktop\Eclipse\jre\bin\javaw.exe
javaw.exe is your current PATH"
I was checking my PATH and JAVA_HOME variables, which where both set to C:\Programm Files(x86)\Java\jdk1.8.0_51
The file eclipse is looking for is the standart directory where java stores its javaw.exe, i.e Java\jdk1.8.0_51\jdk\bin\jawaw.exe, but Eclipse is somehow thinking my path is set to the Eclipse installation directory. Does anyone know how to fix this issue?
It is a bad idea to have JAVA_HOME set to a folder in "c:\program files..." because of the space in the folder name. Whenever this value is used as a command line argument, the receiver would interprete it as two arguments ("C:\program" and "file...").
Move your jdk into a folder without space in the name, and correct your JAVA_HOME variable.
BTW: eclipse resolves first the system PATH variable in order to find a suitable java SDK. It's a good practice, to declare the desired SDK in the eclipse.ini file (in eclipse install-folder). Add there an argument:
....
-vm
C:\JDK8\bin\javaw.exe
-vmargs
-Xms40m
-Xmx384m
Note that the -vm arg and its value must appear on separete lines and must be placed just before the -vmargs argument.

Correctly install Java for Matlab

I am trying to extract a jar file from Matlab code using javac from Library Compiler (java package).
I have set JAVA_HOME to:
C:\Program Files\Java\jdk1.7.0_71
and added to PATH:
C:\Program Files\Java\jdk1.7.0_71\bin.
When I enter java -version in my console, I get java version jdk1.7.0_71 and running javac -version shows jdk1.7.0_71.
However, it seems that matlab could not find javac, thus, I am not able to compile my .m code into a .jar file. When I tried to compile .m code I got the following:
Error: An error occurred while shelling out to javac (error code = -1).
Unable to build executable.
Executing command: ""C:\Program Files\Java\Java\jdk1.7.0_11\bin\javac" -verbose - classpath "...\MATLAB\R2014a\toolbox\javabuilder\jar\javabuilder.jar" -d "...\features_extraction\for_testing\classes" "...\features_extraction\for_testing\features_extraction\Class1.java" "...\features_extraction\for_testing\features_extraction\Features_extractionMCRFactory.java" "...\for_testing\features_extraction\Class1Remote.java" "...\for_testing\features_extraction\package-info.java""
This is the directory of my java bin folder and javac.exe exists : ...\Java\jdk1.7.0_71\bin\bin\javac? I found this link for compatibility between Java and Matlab2014a(which is my version) here. What should I check in order to correctly link Matlab to Java? A few days ago Matlab was working correctly with Java.
In my PATH I noticed the existence of the following path: C:\ProgramData\Oracle\Java\javapath in which there are three wrong shortcuts to java.exe, javac.exe, and javax.exe. When I type in matlab console getenv JAVA_HOME I am getting C:\Program Files\Java\jdk1.7.0_11 while when I wrote version -java I got: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode. When I write javac in matlab console I am getting: Undefined function or variable 'javac'.
When I try to built C++ library I got a similar issue: Error: An error occurred while shelling out to mbuild (error code = -1).
Unable to build executable.
EDIT: Does the absence of the proper MCR counts in my case?
You said
getenv JAVA_HOME I am getting C:\Program Files\Java\jdk1.7.0_11 while when I wrote version -java I got: Java 1.7.0_11-b21
try to use setenv in MATLAB, doc here http://www.mathworks.com/help/matlab/ref/setenv.html
setenv('JAVA_HOME','C:\Program Files\Java\jdk1.7.0_71');
setenv('PATH','C:\Program Files\Java\jdk1.7.0_71\bin');
Following from the answers in this link
http://www.mathworks.com/matlabcentral/answers/131639-matlab-deploytool-not-working-fails-while-building
seems like you have to install JDK 1.7.0_11-b21, which is the one your MATLAB version is compatible with for compiling into jar. Also, after installing that specific version, you should modify the JAVA_HOME and PATH environment variables. Try that to see if it helps.
I was having a very similar problem with my installation.
I set the environment variable (press > type env > Enter) JAVA_HOME (under "User variables") to my JDK home directory (not the bin folder) without any trailing \ or ;.
The problem occurs because MATLAB cannot execute javac properly, however, in order to work out exactly what MATLAB is trying to execute (which is not working) we need to use the command window and not the Library Compiler.
It appears you have already done this but for completeness I will add the process here for others.
To find what MATLAB executes, click "Open log file" and copy the entire first line.
Paste the first line in the MATLAB command window and add -v to the end.
Press enter to run the command and note the "Executing command:" that is printed to the screen.
Once you have the "executing command" that MATLAB returns for you, check the first path in that command and make sure it matches your javac file.
In your original post you have done this and posted
C:\Program Files\Java\Java\jdk1.7.0_11\bin\javac
a path which contains \Java\Java, if this isn't a typo then it may be a problem as it is not the default Java installation path. You also say after that your installation is at
...\Java\jdk1.7.0_71\bin\bin\javac
which contains \bin\bin and is also not the default java bin install directory, perhaps another typo?
If the path to javac matches exactly you could try copying and pasting the "executing command" into your OS's command window (+R > cmd > Enter) and looking for errors. By doing this we can remove ourselves from the MATLAB installation and if errors still exist it likely has nothing to do with MATLAB.
To see if the same problem could be caused by other environment variables I removed every other path to a java installation (keeping JAVA_HOME) in my environment variables. MATLAB uses the absolute path to the java installation and so it was still able to compile with javac using only the JAVA_HOME environment variable.

Updating Java Breaks Eclipse Running

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

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