eclipse生成jar

使用eclipse生成jar文件(jar)
程序里引用了别的JAR包

项目文件夹下建一个META-INF文件夹里面新建一个
MANIFEST.MF的文件内容大至如下
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.5.0_06-57 ("Apple Computer, Inc.")
Built-By: hani
Main-Class: com.opensymphony.workflow.designer.Launcher
Class-Path: looks.jar forms.jar syntax.jar jgraph.jar foxtrot.jar osworkflow-2.8.0.jar oscore-2.2.5.jar

Main-Class:要运行的类。
Class-path:要引入的包
用eclipse导出jar文件里,选择
user existing manifest from workspace
manifest file:/项目名/src/META-INF/MANIFEST.MF

---------------------------------------------------------------
使用eclipse生成文档(javadoc)
使用eclipse生成文档(javadoc)主要有三种方法:
1,在项目列表中按右键,选择Export(导出),然后在Export(导出)对话框中选择java下的javadoc,提交到下一步。
在Javadoc Generation对话框中有两个地方要注意的:
javadoc command:应该选择jdk的bin/javadoc.exe
destination:为生成文档的保存路径,可自由选择。
按finish(完成)提交即可开始生成文档。
2,用菜单选择:File->Export(文件->导出),
剩下的步骤和第一种方法是一样的。
3,选中要生成文档的项目,然后用菜单选择,
Project->Generate Javadoc直接进入Javadoc Generation对话框,剩余的步骤就和第一种方法在Javadoc Generation对话框开始是一样的。

---------------------------------------------------------------
有时候想把某些.jar文件当作所有工程的共用部分,比如log4j-1.2.13.jar,怎么设置才能共用。

每次都是通过设定工程--参数--库 来增加外部jar文件来实现的,这样新建一个工程就要设定一次,麻烦。

把eclipse 默认的jre包编辑下,加入想默认加入的jar包,然后把这个jre设置为eclipse默认建立工程时使用的jre就可以了。
eclipse>window>preferences>java>installed JREs>编辑默认的jre环境

----------------------------------------------------------------
To create a new JAR file in the workbench:
1. In the Package Explorer, you can optionally pre-select one or more Java elements to export. (These will be automatically selected in the JAR Package Specification wizard page, described in Step 4.)
2. From the menu bar, select File > Export.
3. Select JAR file, then click Next.
4. In the Jar Package Specification page, select the resources that you want to export in the Select the resources to export field.
5. Select the appropriate check box to specify whether you want to Export generated class files and resources or Export Java source files and resources.Note: Selected resources are exported in both cases.
6. In the Select the export destination field, either type or click Browse to select a location for the JAR file.
7. Select or clear the Compress the contents of the JAR file check box.
8. Select or clear the Overwrite existing files without warning check box. If you clear thischeck box, then you will be prompted to confirm the replacement of each file that will be overwritten.Note: The overwrite option is applied when writing the JAR file, the JAR description, and the manifest file.
9. You have two options:
Click Finish to create the JAR file immediately.
Click Next to use the JAR Packaging Options page to set advanced options, create a JAR description, or change the default manifest.
提醒:一定要按Next,到最后一步的那个画面中,有一个项,是选择入口类,也就是主类。这个一定要设置,否则,打包完后的.jar是不能运行的。
----------------------------------------------------------------

java生成的exe可执行文件,执行的前提是必须机器上面安装了JVM(java虚拟机),就是说,不是任何一台机器都能跑java做的exe。
换句话来说,JAVA是调用底层的C包,必须经过虚拟机的编译。也正是如此,JAVA具有跨平台性。

几种java转exe的工具

1. 从www.towerj.com获得一个TowerJ编译器,该编译器可以将你的CLASS文件编译成EXE文件。
注:现在已经找不到,不提供了,被人家收购了。

2. 利用微软的SDK-Java 4.0所提供的jexegen.exe创建EXE文件,这个软件可以从微软的网站免费下载,地址如下:
http://www.microsoft.com/java/download/dl_sdk40.htm

jexegen的语法如下:

jexegen /OUT:exe_file_name
/MAIN:main_class_name main_class_file_name.class
[and other classes]

3. Visual Cafe提供了一个能够创建EXE文件的本地编译器。你需要安装该光盘上提供的EXE组件。

4. 使用InstallAnywhere创建安装盘。

但就是要>8M(带jre),还有一种是>1M的(不带jre)。
但是它可以编译成各种平台上可以使用的exe程序。

5. 使用IBM AlphaWorks提供的一个高性能Java编译器,该编译器可以从下面的地址获得:
http://www.alphaworks.ibm.com/tech/hpc

6. JET是一个优秀的Java语言本地编译器。该编译器可以从这个网站获得一个测试版本:
http://www.excelsior-usa.com/jet.html

7. Instantiations公司的JOVE
http://www.instantiations.com/jove/...ejovesystem.htm
JOVE公司合并了以前的SuperCede,一个优秀的本地编译器,现在SuperCede已经不复存在了。

注:太烦了,老是出来一个对话框,表示这是jove公司的产品。

8. JToEXE
Bravo Zulu Consulting, Inc开发的一款本地编译器,本来可以从该公司的网页上免费下载的,不过目前在该公司的主页上找不到了。
公司主页:http://www.bravozulu.com/

9.Exe4j

10.jbuilder
在jbuilder6.0以前的(包括6.0),是不能生成exe文件的,还有jbuilder7.0开始都可以生成exe文件。
参考资料:http://www.programfan.com/article/showarticle.asp?id=2720它的优势也是它的劣势

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值