一直不知道原来在公司的时候那些公用的接口或者类,都是怎样被打包成jar文件放入工程的,昨天研究了一下终于学会了。一般来说公用的东西有两种一种是类,另外一种是配置文件,我试验了类。其实很简单,因为Eclipse有自带的打包成jar文件的工具,右键单击你想要打包的类(如果是多个的话,要从包的顶级来打)右键—》Export—》Java—》JAR File—》next 然后那个 JAR File后面是jar文件的保存路径以及保存名字。实际上如果不是单独运行类,而只是把这些提供给别人使用的话,就无需指定void main的入口了。不过好像如果你在同一个包下打包过一个类是包含main函数的话,再次更改包后继续打包(比如增加一个类。没有void main)他都会提示说这个类打包不了,至今没解决,我只是把所有的类都不加void那样打包成功的。

再学习一下了,肯定还有机会用到得。

—-2009/10/15

Tags:

Related posts

Tags: .
Home

No Comments Now!

Be the first to comment on this entry.

Leave a comment

Name(required)
Mail (required),(will not be published)
Website(recommended)

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URLs must be fully qualified (eg: http://hanghang.name),and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.