简体   繁体   English

无法在 VS 代码中运行测试

[英]Not able to run Tests in VS code

I am fairly new to programming( 1st year CompSci).我对编程相当陌生(第一年 CompSci)。 I decided to write my java code in VSCode.我决定在 VSCode 中编写我的 java 代码。 I Have a test file but whenever i try to run the test i get the following errors in the Debug Console:-我有一个测试文件,但是每当我尝试运行测试时,我都会在调试控制台中收到以下错误:-

Unrecognized option: -ea,--enable-preview

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.

I have a "lib" folder in the folder containing my java and test file which contains the junit-platform-console-standalone-1.5.2.jar我的文件夹中有一个“lib”文件夹,其中包含我的 java 和包含 junit-platform-console-standalone-1.5.2.jar 的测试文件

If I click on Debug Test, I get a popup error saying如果我单击调试测试,我会收到一个弹出错误消息

"Failed to launch debuggee VM. Reason: com.sun.jdi.connect.VMStartException: VM did not connect within given time: 10000ms"

Any Ideas on how to fix this please?关于如何解决这个问题的任何想法?

Thank You.谢谢你。

Fixed it myself.自己修好了。 Apparently something wasn't correctly configured in my VSCode installation.显然,在我的 VSCode 安装中没有正确配置某些东西。

I just reinstalled it along with the java extensions and everything works fine now我刚刚将它与 java 扩展一起重新安装,现在一切正常

I had a silimar error, the problem was that the path where my project was in the workspace had blank spaces, for example:我有一个类似的错误,问题是我的项目在工作区中的路径有空格,例如:

C:\Users\user\my workspace\proyect ----solution----> C:\Users\user\myWorkspace\proyect C:\Users\user\my workspace\proyect ----解决方案----> C:\Users\user\myWorkspace\proyect

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM