m2eclipse is unable to locate C:\Program Files\Java\jre6\..\lib\tools.jar
eclipse, java, m2eclipse, maven
Solution
I figured out a workaround that seems to work. It's not really that what I hoped to be a solution but at least I can use maven now.
I created a new folder on the same level in the file system as the jdk and the jre folders are. I called it lib and copied the tools.jar file form the jdk into it.
Additionally I switched from the "normal" eclipse for java SE to the eclipse for Java EE (I'm using EJBs). The version of eclipse is the one we got from university so i don't know if a plugin is installed which I missed to install on my (java SE) eclipse.
Now It seems to work but if anybody has a solution that might solve that problem in a more elegant way please let me know.
Problem
I have a problem, concerning the jdk/jre usage of my eclipse. I know that this question was asked and answered a lot of times here and I researched what could be wrong for quite a while. I actually didn't find anything so I'm going to ask you again. Maybe I'm missing something (if yes, I hope it's not to embarrasing :) My problem is, that when I'm running mvn clean install I get an error which says that the m2eclipse plugin is "Unable to locate the Javac Compiler in: C:\Program Files\Java\jre6..\lib\tools.jar". First thing I checked was if the right JRE was configured in eclipse. So I switched into Window > Preferences > Java > Installed JREs and checked if the selected jre is the jre inside my jdk folder. This was the case. I checked the eclipse.ini and added a -vw flag to it. It now looks like: ``` -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 -product org.eclipse.epp.package.java.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vm "%JAVA_HOME%\bin\javaw.exe" -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx384m ``` The %JAVA_HOME% is resolved to C:\Program Files\Java\jdk1.6.0_24. Since it contains a space I surrounded the vw path with quotes. To check if the path is really correct I tried ``` C:\Windows\System32>echo %JAVA_HOME% C:\Program Files\Java\jdk1.6.0_24 ``` which tells me that it is correct. I also tried to pass the -vw option when eclipse is started. So the command to start eclipse was then ``` D:\Programs\eclipse\eclipse.exe -vm "%JAVA_HOME%\bin\javaw.exe" ``` I also tested if there is a difference when I use the %JAVA_HOME% notation or if I writed the full path (it makes no difference). The configuration of eclipse, which I get when I go to Help > About Eclipse > Installation Details > Configuration, looks like that: ``` __wbp.gwt.useWebKit=true awt.toolkit=sun.awt.windows.WToolkit veclipse.application=org.eclipse.ui.ide.workbench eclipse.buildId=M20120208-0800 eclipse.commands=-os win32 -ws win32 -arch x86_64 -showsplash -launcher D:\Programs\eclipse\eclipse.exe -name Eclipse --launcher.library D:\Programs\eclipse\\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110 502\eclipse_1406.dll -startup D:\Programs\eclipse\\plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar --launcher.overrideVmargs -exitdata 3e30_64 -product org.eclipse.epp.package.java.product -vm C:\Program Files\Java\jdk1.6.0_24\bin\javaw.exe eclipse.home.location=file:/D:/Programs/eclipse/ eclipse.launcher=D:\Programs\eclipse\eclipse.exe eclipse.launcher.name=Eclipse eclipse.p2.data.area=@config.dir/../p2/ eclipse.p2.profile=epp.package.java eclipse.product=org.eclipse.epp.package.java.product eclipse.startTime=1335643108722 eclipse.vm=C:\Program Files\Java\jdk1.6.0_24\bin\javaw.exe eclipse.vmargs=-Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx384m -XX:MaxPermSize=256m [...] ``` I also tried to use the javaw.exe that is located in %JAVA_HOME%\jre\bin\ which also doesn't change anything. One thing that is a little bit strange is, that if I delete the reference to the jre, the one that is not included in jdk, in Window > Preferences > Java > Installed JREs I get an error which says "The specified JRE installation does not exist". Does anyone have an idea what I'm doing wrong? I think I tried anything to make it work and according to the other articles I found I'm doing it right. Btw: I did some Maven "Update Project Dependencies" and "Update Dependencies" which work, so I did not get any error there. The only thing, I did not do is to restart my computer...