When starting a JUnit test in Eclipse suddenly takes ages (the process starts quickly as you can see in the Console view but it takes ages until the tree of tests appears in the JUnit view), you might experience troubles with IPv6.
The background of the issue: Modern OSs assign your network cards two addresses, one for the old IPv4 and one for the new IPv6. When IPv6 isn’t configured correctly, Eclipse will try to connect via this route and it will take some 30 seconds for Eclipse and the JUnitRunner process to begin talking to each other.
The quick fix is to disable IPv6 or to tell Java to prefer IPv4:
- Disable IPv6 on Linux
- Disable IPv6 on Windows
- Disable IPv6 on MAC OS X Lion
- To make Java prefer IPv4, add this to the command line (launch config and eclipse.ini): -Djava.net.preferIPv4Stack=true