Getting error Could not find or load main class org.testng.TestNG

automated-tests, selenium, testng

Solution

Copy the below commands in a text file.

Edit the location.

Save it as `yourtext.bat`

Now, double click on the batch file created.

cd C:\Workspace\projectname

java -cp C:\Workspace\projectname\lib*;C:\Workspace\projectname\bin org.testng.TestNG testng.xml

Problem

I'm trying to run `TestNG` from command line, but it's giving me error. Can someone tell me where am I going wrong? java -cp C:/TestNG directory/testng-6.2.jar;C:\project directory\src\com\suites\suite\shop org.testng.TestNG testng.xml Error: Could not find or load main class org.testng.TestNG My scripts runs fine when I ran them from `eclipse testng plugin`.

Original source