Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program Files\Java\jre7
Solution 1
I looks like a java issue. Check your java_home directory. Is it pointing to C:\Program Files\Java\jre7 ? If so let maven also point to read same location by configure the toolchains.xml in your maven directory (e.g D:\maven-2.2.1\conf) to your java version
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>1.7</version> <!--This should be same as is configured via the toolchains plugin -->
<vendor>ibm</vendor> <!--This should be same as is configured via the toolchains plugin -->
</provides>
<configuration>
<jdkHome>C:\Program Files\Java\jdk1.7.0</jdkHome>
</configuration>
</toolchain>
</toolchains>
Solution 2
I was also getting the error:
[WARNING] Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program Files\Java\jre6
but I don't get the
[WARNING] could not read workspace project:c:\Users\Acer\workspace.metadata.plugins\org.eclipse.core.resources.projects\myproject
(perhaps you were not setting your workspace path up correctly on the mvn command line by using the option -Declipse.workspace=...)
Anyway, the first warning was caused by me using a JDK in a non-standard place (JAVA_HOME=C:\tools\java\jdk1.6.0_31) and setting my Eclipse workspace up to use that as the default. The Maven Eclipse plugin does not seem to choose the default JDK correctly, The "mvn eclipse:eclipse" would not work until I removed the JDK in "C:\Program Files\Java\jre6" from the list of installed JDKs within Eclipse. I only have the correct one in the list now.
Solution 3
Add your own JRE, remove the default JRE installed in Eclipse. Yeah, it works.I could get no warning information when typing the command mvn eclipse:eclipse.
Comments
-
KItis almost 2 years
I am new to maven and i have been creating simple web application with maven using hibernate, spring etc. i get following error occur when i run
mvn eclipse:eclipse
command.[WARNING] Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program Files\Java\jre7 [WARNING] could not read workspace project:c:\Users\Acer\workspace\.metadata\.plugins\org.eclipse.core.resources\.projects\myproject org.codehaus.plexus.util.xml.pull.XmlPullParserException: processing instruction can not have PITarget with reserveld xml name (position: START_D OCUMENT seen \r\n<?xml ... @2:7) at org.codehaus.plexus.util.xml.pull.MXParser.parsePI(MXParser.java:2453) at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog(MXParser.java:1447) at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1395) at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1093) at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:187) at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:83) at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:48) at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.readArtefact(ReadWorkspaceLocations.java:341) at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.readWorkspace(ReadWorkspaceLocations.java:536) at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.init(ReadWorkspaceLocations.java:94) at org.apache.maven.plugin.eclipse.EclipsePlugin.getWorkspaceConfiguration(EclipsePlugin.java:2063) at org.apache.maven.plugin.eclipse.EclipsePlugin.fillDefaultClasspathContainers(EclipsePlugin.java:1580) at org.apache.maven.plugin.eclipse.EclipsePlugin.setup(EclipsePlugin.java:978) at org.apache.maven.plugin.ide.AbstractIdeSupportMojo.execute(AbstractIdeSupportMojo.java:500) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) [INFO] no substring wtp server match.
this is my pom.xml
could anybody tell me what i am doing wrong here. thanks in advance for any help
-
KItis almost 12 yearsi did what you have mentioned, but no luck
-
om39a almost 12 yearsAre you executing this command in command prompt or in eclipse?
-
om39a almost 12 yearscheck if this link helps