JAVA程序的打包和形成可独立运行软件
2008-11-0410:31
1用eclipse打包成*.jar,然后建立*.bat批处理文件。
首先保证程序在Eclipse下的正常执行,然后方法如下:
(写在最前面做好的Eclipse打包还是使用插件Fat jar)
下载地
址:sourceforge/project/showfiles.php?group_id=115990&pack age_id=125924
使用说明:
Fat Jar Eclipse Plug-In Tutorial
Step1:Create a new Java Project"demolib"
Create a new Java Project named"demolib".
Add the Class"demolib.DemoLib.java"containing the following code: package demolib;
public class DemoLib{
public static void sayHello(){
System.out.println("Hello");
}
}
The Project should look something like this:
Step2:Create a jar file using Fat Jar Plug-In
In the"Package-Explorer"(not the"Resource-View")right click on the project"demolib".
Select"+Build Fat Jar".
A Configuration Dialog appears.Just press"Finish".
The File"demolib_fat.jar"has been created in the project root directory.
Step3:Create a new Java-Project"demorun"
Create a new Java Project named"demorun".
In the project properties add the Library"demolib/demolib_fat.jar"to the Java Build Path":免费软件下载网站入口
Step4:Create Main Class
Add the Class"demorun.DemoRunMain.java"containing the following code: package demorun;
import demolib.DemoLib;
public class DemoRunMain{
public static void main(String[]args){
DemoLib.sayHello();
}
}
The Project should look something like this:
Step5:Start the Build Fat Jar Dialog
Start the Export Wizard from the File-Menu("File"->"Export"). Select"+Fat Jar Exporter"and click"next>".
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论