Java 虚拟机启动器错误 - 发生了 Java 异常
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21662588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java virtual machine launcher error- A java exception has occurred
提问by user3290189
I am a beginner. I am trying to run a java JDBC program in Eclipse with tomcat server. But when I run the program a pop up "Java virtual machine launcher" window with "A java exception error has occurred" is coming up.I think the code compilation is fine.
我是初学者。我想在 Eclipse 中使用 tomcat 服务器运行 java JDBC 程序。但是当我运行程序时,会弹出一个带有“发生java异常错误”的“Java虚拟机启动器”窗口。我认为代码编译很好。
So how should I fix this problem.When I surf through different websites, some are saying that I should re-install java again . Is it true. Please help me with the answers.
那么我应该如何解决这个问题。当我浏览不同的网站时,有人说我应该重新安装java。是真的吗。请帮我解答。
Thanks in advance
提前致谢
回答by Omar Faroque Anik
For me, I just delete my metaData folder and start eclipse with importing all the necessary project and library files.
对我来说,我只是删除了我的 metaData 文件夹并通过导入所有必要的项目和库文件来启动 eclipse。
回答by Rahul
The same virtual machine launcher error - java exception has occurred happened with me in eclipse .This error was due to the package name . I changed the package name and the problem solved. Java does not apply some package name using "java" keyword .
同样的虚拟机启动器错误 - 我在 eclipse 中发生了 java 异常。这个错误是由于包名造成的。我更改了包名,问题解决了。Java 不使用“java”关键字应用某些包名称。
回答by Lucky
Problem reason
问题原因
This problem occurs when you are copying the whole eclipse workspace from one System to another system(with a different JVM or configuration). The .metadata
folder inside your project's workspace folder contains the information about the runtime of your project.
当您将整个 eclipse 工作区从一个系统复制到另一个系统(具有不同的 JVM 或配置)时,会发生此问题。该.metadata
项目的工作区文件夹内的文件夹中包含了有关项目运行的信息。
Solution
解决方案
Close eclipse if it is open and just delete the .metadata
folder under your eclipse workspace. Start you eclipse again and you will see the .metadata
is freshly created based on your current JVM configurations.
如果.metadata
eclipse 处于打开状态,请关闭它,然后删除eclipse 工作区下的文件夹。再次启动 eclipse,您将看到.metadata
根据您当前的 JVM 配置新创建的。
回答by spacewanderer
As explained in some of the answers, removing the .metadata folder, present inside the workspace, works. But this issue can also occur if the package name starts with java. So typically java.example.com
would cause this error. You can use com.java.example
.
正如一些答案中所解释的那样,删除工作区中存在的 .metadata 文件夹是有效的。但是如果包名以 java 开头,也会出现这个问题。所以通常java.example.com
会导致这个错误。您可以使用com.java.example
.
回答by J. Mel
I had the same problem occur when I cleaned my project as well as when it was trying to build. For me, the error was a mismatch between my ant version (1.10) and my default JRE (JDK 1.7). Apparently ant 1.10 is not compatible with JDK 1.7. Changing the default JRE to JRE 1.8.0 fixed the problem.
当我清理我的项目以及尝试构建时,我遇到了同样的问题。对我来说,错误是我的 ant 版本 (1.10) 和我的默认 JRE (JDK 1.7) 不匹配。显然 ant 1.10 与 JDK 1.7 不兼容。将默认 JRE 更改为 JRE 1.8.0 解决了该问题。
Window > Preferences > Java > Installed JREs > Add... > find the java 1.8 version, add it and then select the check box next to it. > OK
Window > Preferences > Java > Installed JREs > Add... > 找到 java 1.8 版本,添加它,然后选中它旁边的复选框。> 好的
回答by danielctw
I faced the same issue with my Eclipse (currently using Eclipse Photon). While trying the metadata delete method did not work, as I am running on JDK 1.7, it seems that the current version of Ant is Ant 1.10, so setting ANT home to 1.9 solved the issue.
我的 Eclipse(目前使用 Eclipse Photon)遇到了同样的问题。虽然尝试元数据删除方法不起作用,但由于我在 JDK 1.7 上运行,Ant 的当前版本似乎是 Ant 1.10,因此将 ANT home 设置为 1.9 解决了该问题。
Go to Windows > Preferences > Ant > Runtime > Ant Home and then point to the version of Ant needed.
转到 Windows > Preferences > Ant > Runtime > Ant Home,然后指向所需的 Ant 版本。
回答by Deva
In my case, both JDK 1,7 and JRE 1.8 was present in the java build path>>library. I removed JDK 1.7, it resolves my problem.
就我而言,JDK 1,7 和 JRE 1.8 都存在于 java 构建路径>>库中。我删除了 JDK 1.7,它解决了我的问题。
回答by Marko
Just update your chromedriver or geckodriver
只需更新您的 chromedriver 或 geckodriver