0
我試圖從XSDGeneratorTest.java運行測試。但我得到以下異常:現有的JUnit類未找到異常
Class not found com.level3.pcat.xsd.XSDGeneratorTest
java.lang.ClassNotFoundException: com.level3.pcat.xsd.XSDGeneratorTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
我試圖claen和建設項目很多時候,但仍同樣的錯誤! 我嘗試了JUNIT Test class in Eclipse - java.lang.ClassNotFoundException的所有選項,但都沒有爲我工作!
http://stackoverflow.com/questions/2639018/why-is-my-test-not-running – Behnil
我通過移動JRE系統庫上的Maven Dependencies然後執行mvn clean test來解決了這個問題。不知何故,只是移動JRE系統庫上的Maven Dependencies並不適合我! – One
http://stackoverflow.com/questions/11381068/ – nhylated