How to solve [TestNG] [Error] Cannot find class path

6,848 views
Skip to first unread message

Satyajeet Paygude

unread,
Nov 23, 2015, 1:25:57 AM11/23/15
to testng-users
Hello guys ,

Plz plz for goodness sake help me for the below issue .. I have lost my whole holidays for the below doing all permutations combinations for solving this :( - 

Below is step wise description for the issue : 

1. I created my TESTNG Xml -file(TESTNG_profileChnge_Run.xml) to run selected tests and it was correctly executing in Eclipse IDE by running it .

2. Then I decided to have batch file of it so I created below bat file with below description : 

java -classpath "D:\Selenium\Library\TestNG_Jars\testng-6.8.jar";"D:\Selenium\Library\selenium-server-standalone-2.47.1.jar";".\src" org.testng.TestNG "D:\Selenium_workspace\TestNG_Multipletestcase\TESTNG_profileChnge_Run.xml"
pause

but it is throwing error  [TestNG] [Error] Cannot find class path.

M not sure why it is throwing me this errors . Can any one kindly help for this one ? 

Hubert Grzeskowiak

unread,
Nov 23, 2015, 10:33:02 AM11/23/15
to testng-users
Hi,

I think the error comes from your wrong classpath setting. You're putting quotes around every entry instead of the whole parameter. It should be "D:\Selenium\Library\TestNG_
Jars\testng-6.8.jar;D:\Selenium\Library\selenium-server-standalone-2.47.1.jar;.\src". Only one pair of quotes for the whole list.

Good luck
Hubert Grzeskowiak

Nguyen Thai Hoang

unread,
Jan 28, 2016, 9:17:33 PM1/28/16
to testng-users
Hi Guys,
I'm facing the same issue some days ago, but it happens intermittent. My solution in case of [TestNG] [Error] Cannot find class path. is going to Eclipse, chose Project --> Clean, then re-run the command again, it works.

So I don't know how to do "Project --> Clean" on Eclipse by command line, any can suggest other solution because I don't want to open Eclipse when doing automation and don't want to manually do "Project --> Clean" on Eclipse.

Many thanks.

Krishnan Mahadevan

unread,
Jan 28, 2016, 9:46:00 PM1/28/16
to testng...@googlegroups.com
Project > Clean is an IDE specific thing.
From command prompt you really dont need things like that, as long as you are using a build tool such as ant/maven/gradle because all of these build tools have a properly defined mechanism to cleanup the build path [ target folder in the case of maven ]

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Nguyen Thai Hoang

unread,
Jan 29, 2016, 2:18:04 AM1/29/16
to testng-users
Thank Krishman for your suggestion ! I'm not family with Build Tool but will give a try ;)


On Monday, November 23, 2015 at 1:25:57 PM UTC+7, Satyajeet Paygude wrote:

wabb...@gmail.com

unread,
Mar 4, 2019, 8:18:28 AM3/4/19
to testng-users
Update maven 
Reply all
Reply to author
Forward
0 new messages