JUnit4 + Eclipse“启动期间发生内部错误” [英] JUnit4 + Eclipse "An internal error occurred during Launching"

查看:371
本文介绍了JUnit4 + Eclipse“启动期间发生内部错误”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Eclipse 3.4.2上运行JUnit4测试用例,但是我甚至没有开始。我在我的构建路径和测试应用程序中有junit-4.7.jar。



这是一个简单的例子,说明了我的问题

  ; 
import org.junit.Before;
import org.junit.Test;

public class UTest {
@Test
public void test(){
}

@Before
public void setUp ()throws异常{
}
}

这个编译好的



然后我从Eclipse中执行运行JUnit测试用例,我收到一条带有此消息的错误对话框

 启动UTest遇到问题
在启动UTest期间发生内部错误
java.lang.NullPointerException
/ pre>

什么原因导致这些NullPointerExceptions?我做错了什么?

解决方案

我可以通过删除工作区和Eclipse目录并重新启动来解决这个问题。


I'm trying to run JUnit4 test cases on Eclipse 3.4.2 but it's not even starting for me. I have the junit-4.7.jar in my build path and the test application.

Here is a simple example that illustrates my problem

package test;
import org.junit.Before;
import org.junit.Test;

public class UTest {    
    @Test
    public void test() {
    }

    @Before
    public void setUp() throws Exception {
    }
}

This compiles fine

Then I do "Run JUnit Test case" from Eclipse and I get an error dialog with this message

"Launching UTest' has encountered a problem
An internal error occurred during: "Launching UTest".
java.lang.NullPointerException

What causes these NullPointerExceptions? What am I doing wrong?

解决方案

I was able to fix this just by deleting the workspace and the Eclipse directory and starting over.

这篇关于JUnit4 + Eclipse“启动期间发生内部错误”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆