天终于研究明了怎么样把spark客户如何打包成exe文件了,现写出与大家分享。

spark里面自带着install4j_3_2版的程序,你也可以单独下载4.0以后的版本。关于install4j的一些说明文档,请查看其它相关的文章。

Run "ant release" from the build directory.

// 运行Ant后,会在文件夹内生成了一个target的文件夹。

Run startup.bat from the target\build\bin directory to make sure your customized Spark is functional.

Run spark.install4j from the build\installer directory and make the following customizations to the project in install4j:


  • In "General Settings", go to the "Compiler Variables" tab to change the VERSION_REVISION to the correct number and find and replace "Spark" with your custom application name. Then go to the "Media File Options" tab to replace "spark" with ${compiler:APP_SHORT_NAME}.
  • In "Launchers", rename the Spark launcher to ${compiler:APP_NAME}, then right-click that launcher and click "Edit Launcher". Then go to "Executable info" to replace "Spark" with ${compiler:APP_SHORT_NAME}. Then go to "Windows version info" to replace "Spark" with ${compiler:APP_NAME}.
  • In "Installer", go to the "Actions" tab to set the Target file for the desktop link to ${compiler:APP_SHORT_NAME}.
  • In "Media", right-click on the Windows media file and click "Edit Media File". Then go to "Installer options" to replace "Spark" with ${compiler:APP_NAME}. Then go to "Bundled JRE" to choose the JRE to bundle.
  • In "Build", click on "Start Build"