用jsmooth + inno生成exe並製作簡單安裝包

lurenkai0811發表於2015-08-19

jar + jsmooth + inno%26nbsp;

思路: 先由 Jsmooth把jar和相關資源打包生成exe,再由Inno把exe和資原始檔打成安裝包

%26nbsp;

%26nbsp;

一%26nbsp; Jsmooth

%26nbsp;

%26nbsp;

1 下載 安裝 Jsmooth%26nbsp;%26nbsp; 地址:jsmooth.sourceforge.net

%26nbsp;

%26nbsp;

%26nbsp;

2 啟動

%26nbsp;

3 welcome

%26nbsp;

4 skecton %26nbsp; 勾選程式,單例

%26nbsp;

%26nbsp;

5 Executable 需要指定將來生成的exe的名字和位置以及對應的圖示。這裡用png最好,自己以前用的ico格式的不識別
%26nbsp; %26nbsp; %26nbsp; current Directory如果勾選則是相對目錄 %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp; %26nbsp; %26nbsp; 這步結束後建議點選儲存圖示,把此前過程儲存起來等下次直 %26nbsp;接開啟 %26nbsp; %26nbsp;

%26nbsp;

%26nbsp;

6 Appliction 最好首先新增Classpath中的jar和其它資源。可以選擇將一個jar嵌入到將來的exe中,這點對保護原始碼最好不過。最後指定主類

%26nbsp;

7 JVM%26nbsp; select 指定jvm版本範圍,指定是否攜帶獨立的jre(好處是不管目標機器是否安裝java都可以執行,缺點壓縮包比較大)

8 JVM Configure 配置jvm引數和memory大小範圍

%26nbsp;

%26nbsp;

9 編譯 %26nbsp; 點選小齒輪編譯成功,之後去指定目錄檢視執行生成的exe %26nbsp;
%26nbsp; %26nbsp; %26nbsp; 本例生成的是myexe.exe %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp; %26nbsp; %26nbsp; 本例主要目標是把EC.jar打包成myexe.exe,其它都是資源和依賴檔案

%26nbsp;

%26nbsp;

%26nbsp;

=======================================================================

二 Inno%26nbsp;

%26nbsp;

%26nbsp;

%26nbsp;

1 下載 安裝 Inno%26nbsp;%26nbsp; 地址:http://www.jrsoftware.org

%26nbsp;

%26nbsp;

2 啟動 新建專案,基本很簡單就是一直點next

%26nbsp;

%26nbsp;

%26nbsp;

3 選擇exe和依賴的資源 注意在新增其它資源時,如果是整個資原始檔夾那麼,新增後系統只會新增子檔案和子資料夾,
%26nbsp; %26nbsp; %26nbsp; %26nbsp; 所有如果要保留整個檔案結構,則需要將這個檔案再放到一個新資料夾中,就是再多一層巢狀,
%26nbsp; %26nbsp; %26nbsp; %26nbsp; 這個新資料夾名無所謂,隨便起 %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;

%26nbsp;

%26nbsp;

%26nbsp;

%26nbsp;

%26nbsp;

%26nbsp;

%26nbsp;

4 確認,生成指令碼並儲存,一直確認YES,到結束

%26nbsp;

%26nbsp;

%26nbsp;

5 檢視生成的Installer 可以進行安裝測試,整體結束

%26nbsp;

%26nbsp;

三 注意和問題

%26nbsp;

%26nbsp;

%26nbsp;

%26nbsp;

jsmooth 需要講ec.jar 嵌入到exe中去,所以在打安裝包的時候就不需要ec.jar了 也是安全 %26nbsp; %26nbsp; %26nbsp;
%26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp;jsmooth 在選擇可執行的二進位制檔案時 一定要自己命名 比 %26nbsp;如 xxx.exe %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp;儲存的指令碼格式例如 abc.jsmooth %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp;inno 坑%26nbsp;%26nbsp; 在新增資源的時候 如果是folder%26nbsp; ,在安裝後會進到子檔案裡 所有 要多加一層%26nbsp;%26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp;myexe.exe要執行起來 必須有個 jre 資料夾 其中包括了 執行時環境(可以自帶jre獨立),Data 和相關的DLL都放到該目錄中。
%26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp;兩個問題 %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp;1%26nbsp; icon 不識別 需要弄個%26nbsp; png格 式 %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;
%26nbsp;2%26nbsp; dll的註冊與登出%26nbsp;%26nbsp;%26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp; %26nbsp;

%26nbsp;

%26nbsp;

相關文章