我试图在Eclipse中导出一个可运行的jar,但是我需要它包含运行我的程序所需的一些其他文件 [英] I'm trying to export a runnable jar in Eclipse, but I need it to include some other files necessary for running my program

查看:152
本文介绍了我试图在Eclipse中导出一个可运行的jar,但是我需要它包含运行我的程序所需的一些其他文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具体来说,我正在使用JDBC库来处理我的Java程序中的数据库。当我在Eclsipe中执行导出Runnable Jar时,它包含引用的库,但是我从来没有给出可以在可运行的jar文件中包含我的资源文件夹(包含数据库)的选择。如果我尝试通过Eclipse导出一个常规的jar文件,我可以添加资源文件夹,但不包括引用的库。我该怎么办?非常感谢。

解决方案

您的资产目录是否在Eclipse中被声明为源文件夹?



右键单击文件夹,选择Build Path-> Use as Source Folder。然后重试导出。



从长远来看,您应该真正看到一个构建工具,如maven或ant,它们更灵活,而且更少依赖于Eclipse,所以Eclipse中项目配置的更改不会影响最终的构建。


Specifically, I am using JDBC libraries to work with databases in my Java program. When I do "Export Runnable Jar" in Eclsipe, it includes the referenced libraries but I am never given an optino to include my assets folder (containing the databases) in the runnable jar file. If I try to export a regular jar file via Eclipse, I can add the assets folder, but the referenced libraries are not included. What should I do here? Thanks a lot.

解决方案

Are your asset directories declared as Source Folders in Eclipse?

Right Click on the folder, choose Build Path->Use as Source Folder. Then retry the export.

In the longer term, you should really be looking at a build tool such as maven or ant, they are much more flexible, and they are less dependent on Eclipse, so changes in your project configuration in Eclipse won't affect the final build so much.

这篇关于我试图在Eclipse中导出一个可运行的jar,但是我需要它包含运行我的程序所需的一些其他文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆