从Eclipse中的工作应用程序导出后,出现ClassNotFoundException [英] ClassNotFoundException after exporting from working application in Eclipse
问题描述
因此,在将项目导出到可运行的jar之后,我会收到此消息.对于这是为什么我一无所知,因为当我在Eclipse中选择运行"时,应用程序会完全运行 .我尝试过提取和打包依赖的库,但没有雪茄.
So I get this message after I have exported my project to a runnable jar. I'm pretty clueless as to why this is since the application runs perfectly when I select "Run" in Eclipse. I've tried both extract and package dependable libraries but no cigar.
有人知道该怎么办吗?
Exception in thread "main" java.lang.NoClassDefFoundError: com/mysql/jdbc/jdbc2/optional/MysqlDataSource
at jp.kddi.geonames.GeoNames.getConnectionWithDataSource(GeoNames.java:55)
at jp.kddi.geonames.GeoNames.setFromGN(GeoNames.java:155)
at jp.kddi.twittercrawler.Attributes.setCoordinatesGeonames(Attributes.java:297)
at jp.kddi.twittercrawler.Attributes.setCoordinatesJSON(Attributes.java:280)
at jp.kddi.twittercrawler.Attributes.SetAll(Attributes.java:42)
at jp.kddi.twittercrawler.TweetList.makeList(TweetList.java:25)
at jp.kddi.twittercrawler.TweetCloud.main(TweetCloud.java:45)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 7 more
推荐答案
似乎您的MySql驱动程序尚未导出.要解决此问题,请转到Project Properties
(右键单击Project
),然后选择Properties
,然后依次选择Java Build Path
和Order and Export
.确保已导出MySql库.
It looks like your MySql drivers haven't been exported. To solve this go to Project Properties
(right-click Project
) and select Properties
and then select Java Build Path
and then Order and Export
. Make sure the MySql library is exported.
这篇关于从Eclipse中的工作应用程序导出后,出现ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!