Note that there are some explanatory texts on larger screens.

plurals
  1. POJunit Testing in Eclipse throws an Exception
    primarykey
    data
    text
    <p>I am using Eclipse 3.5 on Unix machine. I am trying to execute a simple (dummy) JUnit. I am using JUnit 4 framework for writting Junit Test Case. </p> <p>Also, I have added Junit 4.10.jar to the project Build path</p> <p>Here is my Java Class File: FileStats.java</p> <pre><code> package entity; public class FileStats { public int getAllStats(){ return 1; } } </code></pre> <p>FileStatsTest.java</p> <pre><code> package entity; import static org.junit.Assert.*; import org.junit.Test; public class FileStatsTest { @Test public void testGetAllStats() { assertEquals("its equal",1,new FileStats().getAllStats()); } } </code></pre> <p>On executing the test case I get the following error:</p> <pre><code> Exception in thread "main" java.lang.ClassFormatError: Truncated class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: org.ecli pse.jdt.internal.junit.runner.RemoteTestRunner. Program will exit. </code></pre> <p>I have searched and tried restarting , cleaning build path etc. But could not get it working. Any suggestions what might be missing would be really helpful. </p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload