Note that there are some explanatory texts on larger screens.

plurals
  1. POEclipse JUnit 4 gives NullPointerException
    primarykey
    data
    text
    <p>When I try to run a JUnit 4 test i get a NullPointerException in Eclipse. JUnit3 though works. </p> <p>I'm trying the following test class:</p> <pre><code>import static org.junit.Assert.fail; import org.junit.Test; public class Test { @Test public void test() { fail("Not yet implemented"); } } </code></pre> <p>Here is the Exception Stack Trace:</p> <pre><code>java.lang.NullPointerException at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localURL(JUnitLaunchConfigurationDelegate.java:420) at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.entryString(JUnitLaunchConfigurationDelegate.java:409) at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.addEntry(JUnitLaunchConfigurationDelegate.java:396) at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localizeClasspath(JUnitLaunchConfigurationDelegate.java:387) at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getClasspath(JUnitLaunchConfigurationDelegate.java:364) at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:147) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704) at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047) at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53) </code></pre> <p>I'm using OS X Snow Leopard with Java SDK 1.6.0_35 (from Apple). Both JDK and JUnit 4 are in my build path. Has the Java Version something to do with the problem ?</p> <p>UPDATE:</p> <p>Ok I'm an idiot not thinking of this. I installed Eclipse for C/C++ Developers as I had to do something in C++. But I also used the same instance to develop for Android with the Android SDK plugin and I did some small Java Applications. But I didn't have the Java Development Tools or the Java EE Developer Tools installed. I installed them now and JUnit 4 works now. </p> <p>I guess one of this Tools is used for JUnit 4. Strange though that JUnit 3 worked. Anyway it works now. </p> <p>Thank you all for your support though.</p>
    singulars
    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.
 

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