使用 JSmooth 0.9.9-7 將可執行 Jar 包裝裝為 Windows `.exe` 時,點擊 Compile 彈窗報錯:
jsmooth compilation failed error null
無具體行號、異常堆疊,極難定位。
JSmooth 對 `.ico` 文件的解析極其脆弱,常見觸發條件:
SourceForge Bug #84:"JSmooth seems very limited in the size and bitdepth of icons it supports... Try reducing the bit-depth and removing your larger icons to be just 16x16, 32x32 and maybe 48x48 with only 4 or 8 bits of depth."
社區回覆:"After messing around with the parameters, I've fixed my case of 'Error: null'. My solution: Replace the not-working executable icon (.ico file) by a very simple PNG file."
| 工具 | 優點 | 缺點 |
|---|---|---|
| Launch4j | 活躍維護、支援 JRE 綁定、JVM 參數配置、圖標穩定 | 配置稍繁雜 |
| jpackage (JDK 14+) | 官方原生、無第三方依賴、生成原生安裝包 (msi/dmg/deb) | 需 JDK 14+、不支援舊版 JDK 專案 |
| GraalVM Native Image | 極速啟動、體積小、無 JRE | 反射/動態代理需配置、學習曲線陡峭 |
建議:新專案優先用 `jpackage` 或 `Launch4j`,避開 JSmooth 多年未維護的坑。
JSmooth `compilation failed error null` **99% 由圖標文件引起**。「清空圖標 → 驗證 → 換標準圖標」三步驟即可解決。長期來看,遷移至 `Launch4j` 或 `jpackage` 更省心。