找不到指定的 VM 安装: 键入 Standard VM,命名为 jre7

找不到指定的 VM 安装: 键入 Standard VM,命名为 jre7 您在 Eclipse 中构建 Ant 文件时是否遇到过这个问题?那这篇文章是给你的。删除和重新创建工作区不是解决方案。有一个简单的解决方案可以在不重新创建工作区的情况下解决这个问题。

enter image description here

76714 次浏览

Best answer found at

It happened for me after Un-installing Java and installing new version.

All I have to do is in eclipse open Installed JREs from Windows --> Preferences --> Java --> Installed JREs

Then Add new JRE information. Details can be found here

This is a preferred way tell projects which JDK container to use, especially true if two or more devs are using the same version controlled eclipse project folder.

Window/Preferences/Java/Installed JREs
List one or more JDKs installed on your computer. Eclipse defaults name to jdk1.X.X_XX you should keep it as is. Never link project build settings directly to use these names.

Window/Preferences/Java/Installed JREs/Execution Environments
List of common jvm environments such as JavaSE-1.6 and JavaSE-1-7 names. Click rows and choose jre instance on the right side panel. These names are common and all team members should already have them in Eclipse installation.

Step 1: This is where you may accidentally have nothing chosen if JREs were uninstalled or names changed in InstalledJREs setting. You may get

Specified vm install not found error dialog.

Step 2: Choose 2nd mouse on build.xml file/Run As/Ant Build... popup menu entry. Click on JRE tab and choose execution environment. This may have obsolete value from the previous jdk values.

Project Properties/Java Build Path/Libraries
Add Library.../JRE System Library/(x)Execution environment
Choose execution environment to be used for this project. Team members may not have exact _XX jdk build but they can use the same version controlled eclipse project settings. Execution environment mapping hides user specific details.

Just had this issue & the solution above does not work, atleast not for me.

Instead I went the solution provided here:http://www.javaworkspace.com/VMNotFound.do

Essentially you go to the directory C:\projects\WORKSPACE.metadata.plugins\org.eclipse.debug.core.launches

In there search for the string of the JDK that that eclipse is moaining about & change it to the name of your installed JDK that you want to use that eclipse knows about.

You can change what JRE the ant bulid file is launched with inside eclipse.

Right click on the ant file in the ant view and select "Run As"->"Ant..." from the context menu.

Then in the launch dialog select the JRE tab. Note the error message at the top if it can't find the JRE that it expects.

Select a JRE that you have installed or manage install a new one. You can also add vm arguments (enable logging or change memory alocation) if you need to in this dialog.

  1. Right Click on build.xml
  2. Go to "Run As" >> "External Tools Configurations..."
  3. It shall open new window
  4. Go to JRE tab
  5. Select proper JRE if missing (sometimes jre tabs shows error mark on that.)

For more technical details or issue similar to this find my blog here.

The last answer is absolutely correct, however a fast track way is to delete the project reference from eclipse (make sure to keep unchecked delete source) and import your project folder again. This way the project configurations are reset by eclipse using the new jdk. But a wonderful post it did help me.

In my case it happen as I have changed my JRE.

Solution :

Right click on your ant script > Run as > External tool configurations... > Go to JRE tab > select JRE

Hope this help.

Thanks, Sagar Vyas

Just delete the below file

"<Your eclipse workspace location>\.metadata\.plugins\org.eclipse.debug.core\.launches\<projectname>.xml.launch"

link to post

After Java update ant build failed and the below steps fixed it .

Right Click on build.xml-Run As-External Tools Go to JRE tab and check the box to use the JRE same as workspace.

Removed below file and build maven project again, worked for me.

.metadata.plugins\org.eclipse.debug.core.launches\.xml.launch"

(ant file)Run As--> External Tool Configuations, go to JRE tab and choose JRE