TestNG ERROR Cannot find class in classpath: <p>I have a <a href="http://en.wikipedia.org/wiki/Selenium_%28software%29" rel="nofollow">Selenium</a> project with Selenium 2.43.1 and below is my folder structure of the project.</p> <pre><code>F:\SeleniumProject F:\SeleniumProject\Workspace\UIAutomation F:\SeleniumProject&gt;dir 20-Mar-15 02:10 PM &lt;DIR&gt; . 20-Mar-15 02:10 PM &lt;DIR&gt; .. 21-Mar-15 10:15 AM &lt;DIR&gt; eclipse 20-Mar-15 02:10 PM &lt;DIR&gt; Firefox 20-Mar-15 12:23 PM &lt;DIR&gt; Java 20-Mar-15 12:56 PM &lt;DIR&gt; selenium-2.43.1 20-Mar-15 12:41 PM &lt;DIR&gt; Workspace F:\SeleniumProject\Workspace\UIAutomation&gt;dir 20-Mar-15 06:40 PM &lt;DIR&gt; . 20-Mar-15 06:40 PM &lt;DIR&gt; .. 20-Mar-15 01:17 PM 5,856 .classpath 20-Mar-15 12:36 PM 388 .project 20-Mar-15 12:36 PM &lt;DIR&gt; .settings 21-Mar-15 10:16 AM &lt;DIR&gt; bin 20-Mar-15 12:41 PM &lt;DIR&gt; src 21-Mar-15 02:38 PM &lt;DIR&gt; test-output 20-Mar-15 07:39 PM &lt;DIR&gt; testng </code></pre> <p>I have the .class of the test class in <code>src\com\ui\test\scripts</code> I have the .class files of the library files in <code>src\com\ui\test\lib</code> The <code>testng.xml</code> is in the <code>F:\SeleniumProject\Workspace\UIAutomation\testng</code> folder. When I try to execute a testng test from the command line,</p> <pre><code>java -cp "F:\SeleniumProject\selenium-2.43.1\libs\testng-6.8.jar" org.testng.TestNG testng.xml </code></pre> <p>it fails with the below error:</p> <pre><code>[TestNG] [ERROR] Cannot find class in classpath: com.ui.test.scripts.VerificationOfLoginTest </code></pre> <p>I have tried enough to fix this, but I am unable to do it. I almost spent one day to correct this. What could have gone wrong as I can run the tests from <a href="http://en.wikipedia.org/wiki/Eclipse_%28software%29" rel="nofollow">Eclipse</a> successfully?</p>