eclipse使用——生成jar和生产javadoc

来源:互联网 发布:部落冲突黄毛升级数据 编辑:程序博客网 时间:2024/05/21 10:25

使用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是不能运
行的。

原创粉丝点击