`

Junit报错: NoClassDefFoundError:org/eclipse/jdt/internal/junit/runner/RemoteTestR

阅读更多

环境:mac os 10.9.3

IDE:eclipse Kepler

报错内容:

 

Java代码 
  1. Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/junit/runner/RemoteTestRunner  
  2. Caused by: java.lang.ClassNotFoundException: org.eclipse.jdt.internal.junit.runner.RemoteTestRunner  
  3.     at java.net.URLClassLoader$1.run(URLClassLoader.java:202)  
  4.     at java.security.AccessController.doPrivileged(Native Method)  
  5.     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)  
  6.     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)  
  7.     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)  
  8.     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)  

 

 

前提:同事的电脑

起因1:就算写个最简单的输出语句都报错,但是运行main方法没问题。

            根据报错信息去网上搜解决方案,貌似都不靠谱。

            因为我和他同型号电脑,eclipse都是我发给他的。我的就没问题。

           开始检查了他的Junit怎么导入的、版本。。。。

 

解决方案:再看版本的时候发现他把eclipse(看junit的包结构时候发现的)放在了:/Users/xxx/....../软件/  的下面。

                 感觉这应该就是问题所在了。把eclipse放在没有汉字和空格的路径下。问题就解决了。

                有的时候就是感觉。经常会从前的经验,别人说过的某些片段来解决问题。

 

事隔一个月,又报了同一个错误。

 

起因2:他的eclipse没有按照svn,使用其他软件从svn上checkout下来的,然后eclipse本地导入。

          自动化的测试代码随便找一个Run As 就报错。

          感觉想设置问题(ps:当时没想到,就感觉是Junit4.1的jar有问题。)

          搜了一些国内的网站,没搜到正确的。一个国外网站也有人问一模一样的问题。但是没解决。

         搜了半小时都没解决。不知道他怎么突然想看项目编码设置了

解决方案:将项目编码设置成UTF-8,就可以了。我感觉一劳永逸的方式就是把eclipse的workspce的编码设置成UTF-8。

 

分享到:
评论

相关推荐

    windows下eclipse跑junit报错:CreateProcess error=206

    windows下eclipse跑junit报错:CreateProcess error=206后面跟着乱码。 把这个jar替换掉就好了,放在:eclipse/plugins/下面。 参考:https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193

    junit4单元测试报错:method initializationerror not found

    junit4单元测试报错:method initializationerror not found 缺少jar包导致,总共需要三个jar包:junit-4.11.jar,hamcrest-core-1.3.rc2.jar,hamcrest-library-1.3.rc2.jar,都在压缩包里了。

    org.eclipse.jdt.core_3.5.2.v_981_R35x

    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt....

    jaxen.jar和dom4j.jar

    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt....

    junit的jar包

    org.junit.internal.runners.JUnit38ClassRunner.class org.junit.internal.runners.JUnit4ClassRunner.class org.junit.internal.runners.MethodRoadie.class org.junit.internal.runners.MethodValidator.class ...

    Activiti的样例代码

    activiti-learn 本项目包含了一系列工作流引擎Activiti的样例代码。 所有代码都以JUnit4单元测试,请结合本项目的Wiki来使用本项目。 如何运行 ...也可以在eclipse里选择单独的JUnit测试用例执行。

    JUnit技巧:程序员测试实用方法

    JUnit技巧:程序员测试实用方法

    junit-jupiter-api-5.4.2-API文档-中英对照版.zip

    Maven坐标:org.junit.jupiter:junit-jupiter-api:5.4.2; 标签:junit、jupiter、api、中英对照文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化...

    eclipse-jee-photon-R-win32-x86_64.zip

    https://www.eclipse.org/photon/noteworthy/ https://www.eclipse.org/downloads/eclipse-packages/ Take Your Code to the Next Level With Eclipse Photon Eclipse IDE, Photon Edition New and Noteworthy Table...

    Junit4.12和依赖包

    使用Junit4.12需要用的两个包,官网在国内无法下载

    HIbernate4.3.6整合c3p0所需jar

    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt....

    Junit5.zip

    此资源包含了junit5的jar包和源码,junit5-r5.4.0.zip 和demo的zip文件,对于测试来说是比较有用的

    junit-4.12.rar包及依赖包

    使用JUnit 4进行单元测试时,测试程序一直运行失败,报method initializationerror not found错误,添加以下几个jar包即可解决问题,希望可以帮助大家。

    junit-4.13.1.jar

    JUnit 是一个 Java 编程语言的单元测试框架。JUnit 在测试驱动的开发方面有很重要的发展,是起源于 JUnit 的一个统称为 xUnit 的单元测试框架之一。

    PhilipKRoboelectric

    JUnit: : Mockito: ://mockito.org/ Robolectric: //robolectric.org/ 执照 版权所有 2015 David de Miguel Galán 根据 Apache 许可,版本 2.0(“许可”)获得许可; 除非遵守许可,否则您不得使用此文件。...

    junit-4.11.jar

    JUnit报initializationError的解决方法在新搭建的环境上测试时,一个模块发现错误:java.lang.NoClassDefFoundError:org/hamcrest/SelfDescribing 一看就是缺少Class。多方查找,发现是少了hamcrest包。将hamcrest-...

    Mybatis报错: org.apache.ibatis.exceptions.PersistenceException解决办法

    Mybatis报错: org.apache.ibatis.exceptions.PersistenceException解决办法 一、问题描述 写好配置文件用JUnit进行测试,一运行就报错: org.apache.ibatis.exceptions.PersistenceException: ### Error querying ...

    junit单元测试

    需要在build.gradle里面添加dependencies {testCompile 'junit:junit:4.12'}

    在Eclipse中使用JUnit4进行单元测试

    Ant And Junit 代码 博文链接:https://jimi68.iteye.com/blog/88128

Global site tag (gtag.js) - Google Analytics