FatJar是一款运行在eclipse上的插件,通过FatJar这款插件你可以将你的JAVA项目导出为JAR包, 并且如果你的项目包含GUI界面,本机装的也有java运行环境,那就可以直接双击打开了。
那有人问了,eclipse也可以将java项目导出为JAR包,干嘛还要装个插件呢, 因为如果你的项目当中包含的有第三方JAR包,那你的项目就会导出来就不能执行。
但是呢如果你是高版本的eclipse,直接把FatJar插件放到eclipse的插件目录里面, 重启eclipse也不能识别安装,在线安装的话,也会报错,

错误信息: An error occurred while installing the items session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.Install, operand=null --> [R]net.sf.fjep.fatjar 0.0.31, action=). Failed to prepare partial IU: [R]net.sf.fjep.fatjar 0.0.31.
产生这种错误的原因是FatJar插件不支持高版本的eclipse, 那就需要你在安装一个eclipse2.0的插件支持。
Eclipse 2.0 Support安装: Help→Install New Software

输入2.0支持插件的链接: http://download.eclipse.org/eclipse/updates/4.5 回车,耐心等待,下面会出现插件列表,选择 Eclipse Tests,Tools,Examples,and Extras下面的Eclipse 2.0 Style Plugin Support 勾选上,然后点击下面的Next按钮,耐心等待进度条跑完

选中列表中显示的插件,点击下方的Next按钮,

选择 I accept,点击下方的Finish按钮,

耐心等待eclipse右下角的进度跑完,这里需要耐心等待,

进度跑完之后,点击Restart Now按钮重启eclipse 这样eclipse 2.0 support插件就算安装完毕。
FatJar插件安装: Help→Install New Software

输入FatJar插件链接: http://kurucz-grafika.de/fatjar 选择下方的插件,点击下方的Next按钮,耐心等待 然后和安装2.0支持插件安装方式一样,

耐心等待进度条跑完,这里会很慢。

选择Install anyway

点击Restart Now按钮重启eclipse 至此FatJar插件就算安装完毕。
FatJar使用方式:
- 可以右键项目选择Build Fat Jar
- 也可以右键选择Export→选择Other→选择Fat Jar Exporter


点击Browse按钮选择启动类,

选择项目的入口启动类,点击OK按钮,

点击Finish按钮,默认生成的jar包放在该项目的根目录下面。

双击就可以直接打开执行。

至此就成功将项目导出为JAR包格式。