After running Netbeans 7.1.1 for some time suddenly all imports from org.junit.* are missing and I can’t build the project anymore. Even though the plugin JUnit seems to be installed correctly. When I click to automatically resolve missing dependencies in Unit Test Libraries I get following error:
Could not find the JUnit 4 library in the target platform; you need to install JUnit
On other Linux machine with Netbeans 7.1 the very same project runs without any problems. It’s quite strange that the library is called “org.netbeans.libs.junit4” instead of “JUnit 4” and the whole package seems to be empty.
The problem was caused by installing Netbeans with
sudocommand into/usr/local/netbeans*. JUnit is installed afterwards and even though is the installation seems to be completed successfully, some are probably not copied, or not readable.When Netbeans are installed into user’s home directory everything is OK. It seems to be a Netbeans bug which hasn’t been solved since 6.9