Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program Files\Java\jre7

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

like image 948
KItis Avatar asked Feb 20 '23 21:02

KItis


1 Answers

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.

like image 185
Reg Whitton Avatar answered Feb 22 '23 10:02

Reg Whitton