2012-12-17 125 views
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的所有選項,但都沒有爲我工作!

+0

http://stackoverflow.com/questions/2639018/why-is-my-test-not-running – Behnil

+0

我通過移動JRE系統庫上的Maven Dependencies然後執行mvn clean test來解決了這個問題。不知何故,只是移動JRE系統庫上的Maven Dependencies並不適合我! – One

+0

http://stackoverflow.com/questions/11381068/ – nhylated

回答

0

如果在將項目從一個IDE/OS移到另一個IDE/OS時出現這種情況,只需嘗試刪除JUnit3庫並再次添加它。有時你從外面帶上你的攝影機時就會失敗。我被卡住了,直到我這樣做了同樣的錯誤。