在Eclipse中添加外部jar [英] Adding External jar's in Eclipse
问题描述
最简单的解决方案是将您的项目导出为Runnable Jar文件(右键单击在项目 - >导出...-> Runnable Jar文件),将所有依赖关系放在一个jar文件中。
否则,您将需要包含一个类路径到附加js在manifest.mf文件或命令行中使用-cp选项。
java -cp。; myjar。 jar; mysql.jar my.package.classname
I have created a program to connect to MySQL. I add Connector/j using eclipse add external jar option. Program works fine in eclipse. But when I created the executable jar using eclipse and when i run it, it always give ClassNotFoundException. Please tell me how to add external jars to my jar. Or is there any other error? Please can anyone help me.
The simplest solution is to export your project as a 'Runnable Jar file' (Right-click on project->Export...->Runnable Jar file) that will place all dependencies in one jar file.
Otherwise you will need to include a classpath to the additional jars either in the manifest.mf file or on the command line with the -cp option.
java -cp .;myjar.jar;mysql.jar my.package.classname
这篇关于在Eclipse中添加外部jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!