惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 叶川

数据链路层学习之LLDP Win8.1 Metro应用无法联网终极解决方法 Win8.1 Metro应用无法联网,提示“无法加载此页面”解决方法!(看红色字体部分) Telnet协议的java实现 路由反射器(Route Reflector)简介 浅析影响MSTP设备以太网宽带的因素 城域波分组网的若干关键因素考虑 光信噪比 (OSNR) 的概念及其重要性 海事卫星通信系统 MPLS-VPN简介 - 叶川 IP专网VPN技术方案选型 - 叶川 MPLS_TE_FRR技术白皮书 BGP(自治系统间的路由)协议详解 VRRP概述 MPLS 原理详解 关于DHCP原理的讲解 RD与RT(MPLS VPN BGP) - 叶川 爆一个taobao网的BUG(原创) 清除新版阿里旺旺2008自动添加的右键菜单 - 叶川 - 博客园
使用Eclipse制作可执行jar文件
叶川 · 2013-01-28 · via 博客园 - 叶川

1,右击Eclipse项目,点击Export。

2,选中java-jar文件。

3,选中要发布为jar文件的项目。

1)选中源文件夹,库文件夹,配置文件文件夹。

2)不要选中Eclipse项目的文件和其他不需要的文件。

3)选中:Export all output folders for checked projects

输出所有选中的文件夹。

4)选中:Export java source files and resources

如果是源文件夹,就会输出生成的.class文件。

5)选中:压缩Jar文件的内容。Comoress the contents of the Jar file

6)选择一个输出jar文件的目的地。

4,使用已存在的manifest文件。

5,MANIFEST.MF 文件如下:

如果让Eclipse为我们生成,不会生成Class-Path部分的描述。所以,我们需要再加上Class-Path描述!

Manifest-Version: 1.0

Main-Class: Test

Class-Path: lib/OXmlEd1.11-nolib-bin.jar lib/dom4j-1.6.1.jar lib/commons-logging-1.0.4.jar lib/log4j-1.2.8.jar

6,选择MainClass,选择Browser从弹出的对话框中选择要使用的MainClass

6,现在,制作完成的jar文件就是可执行的。

我们在命令行中执行java –jar AAA.jar 就可以看到该程序被成功执行了。

javaw –jar AAA.jar 也可以执行该jar包。

使用java.exe将会出现命令行窗口。

使用javaw.exe执行,不会出现命令行窗口,所有System.out.print这样的输出都是看不到的。

7,如果你安装了JRE,你的jar文件应该关联在javaw –jar上。

如果你的jar文件没有关联javaw –jar了,可以通过以下方法重新关联。

1)在资源窗口—工具—文件夹选项—文件类型中,新建jar的关联。

2)创建一个.bat文件,其中的命令是:javaw -jar %1 或者java -jar %1

3)把.jar文件关联到上面这样的.bat文件中。

这样,你双击.jar文件时,就会立刻执行该java程序。

%1 表示第一个参数,也就是你点击的jar文件的文件全名。

8,你也可以为每一个可执行的jar文件创建一个.bat文件,其中的命令是javaw -jar AAA.jar 或者java –jar AAA.jar等文件。

    这样,无需关联jar文件,就可以执行jar文件。