Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

0
Exception in thread "main" java.lang.NoClassDefFoundError: org/testng/TestNGException - Error in Eclipse

Open 1 Answers 1043 Views
0 1
I trying to run testng with eclipse and I am getting this error

Exception in thread "main" java.lang.NoClassDefFoundError: org/testng/TestNGException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.testng.TestNGException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)

Is there any solution for this?

1 Answer

0
0

It looks like TestNG libraries are not properly added to your build path:

If you are using Eclipse,

In Eclipse> Project > Clean

In case of IntelliJ

Go to configuration tab in TestNG "Run/Debug Configurations and select "In the whole project".

Also, if you are using maven, download all dependencies again and update your dependency tree.

answered by (151 points)

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...