On Fedora 23 with Eclipse and TestNG I am getting an error whenever I try to run a TestNG class. The entire system was updated (using yum (DNF) extender) within the last 24 hours; versions of (what I think are) relevant packages are: eclipse-filesystem 1.0-5.fc23, eclipse-jdt 4.5.2-10.fc23, eclipse-platform 4.5.2-10.fc23, eclipse-testng 6.8.6-6.fc23, testng 6.8.21-2.fc23
Minimal test case (to reproduce): Starting with a completely new workspace: File > New > Project > Java Project enter name "Trivial" Finish Click Yes in the "Open Associated Perspective?" dialog File > New > Package enter name "com.testng.minimalDemo" Finish Right-click "com.testng.minimalDemo" under Trivial/src in Package Explorer Select TestNG > Create TestNG class Select all entries in Annotations Finish
This created NewTest.java, which had multiple errors flagged; the first was "The import org.testng cannot be resolved"
Applying the first Quick Fix "Add TestNG library" cleared all of those errors, but then
Run > Run As > TestNG Test
paused for a few seconds and displayed an error box:
Couldn't launch TestNG Couldn't contact the RemoteTestNG client. Make sure you don't have an older version of testng.jar on your class path.
Reason: Timeout while trying to contact RemoteTestNG
I don't have an older version of testng.jar anywhere -- only the one installed by eclipse-testng 6.8.6-6.fc23.
The console shows:
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 7 more
So it seems there are (at least) two bugs in TestNG, and/or in its eclipse plugin, and/or in its Fedora packaging: 1. Clicking Finish in the Create TestNG class dialog should have added the TestNG library to the project if not already there. I should not have had to add it manually. 2. Something in the eclipse-testng plugin should have taken care of whatever additional configuration is needed to avoid that "JNI error".
How do I get past this?