解決 org.testng.TestNGException: Cannot find class in classpath

今天在使用 TestNG 時出現了下面的訊息,
org.testng.TestNGException: Cannot find class in classpath。
解決方法很簡單,在 Eclipse 上方的選單中,
選擇 Project -> Clean,接著等他重新 build 完就可以了。

圖片來源:http://www.pushtotest.com/pushtotest-for-developers.html

附上錯誤訊息:
org.testng.TestNGException:
Cannot find class in classpath: werdna1222coldcodes.blogspot.com.demo.xxx
 at org.testng.xml.XmlClass.loadClass(XmlClass.java:76)
 at org.testng.xml.XmlClass.init(XmlClass.java:68)
 at org.testng.xml.XmlClass.(XmlClass.java:54)
 at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:500)
 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
 at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
 at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:788)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
 at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
 at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
 at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
 at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
 at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
 at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
 at org.testng.xml.Parser.parse(Parser.java:170)
 at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:276)
 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88)
 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)

關鍵字:TestNG, TestNGException, Cannot find class in classpath
參考資料:

這個網誌中的熱門文章

【銀行代碼查詢】3碼銀行代碼列表、7碼分行代碼查詢

【台北中壢】國道客運/公車路線(1818,2022,9001,9025)!

【博客來折價券】博客來免費序號e-coupon分享(持續更新)

【Hami Video】影劇/電視/運動館免費體驗/試用序號分享(隨時更新)!

Windows 關機、重開機 Command Line (cmd) 指令