jpackage in Java 14
jpackage is a command-line tool to create native installers and packages for Java applications.
Install OpenJDK 14 on Ubuntu 20.04/18.04
curl -O https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz
tar xvf openjdk-14_linux-x64_bin.tar.gz
mv jdk-14 $HOME/opt/
Packing JAR as .deb
mkdir {icons,input,output,temp}
tree -L 3 --dirsfirst --filelimit 10 --sort=name
.
├── icons
│ └── CloudCoin_Wallet-Dark.png
├── input
│ └── CloudCoin.D.3.0.15.jar
├── output
│ ├── CloudCoin_Wallet-Dark
│ │ ├── bin
│ │ └── lib
│ └── cloudcoin-wallet-dark_3.0.15-1_amd64.deb
├── temp
├── build.sh
└── license.txt
7 directories, 5 files
檔案目錄說明:
- icons: App 的圖示檔(*.png), size 256x256
- input: 原始的 jar 檔
- output: 封裝後的 .deb 檔案
- temp: 封裝過程中會用到的暫存檔
- build.sh: 封裝啟動檔
- license.txt: App 的使用授權宣告
build.sh
jpackage \
--type deb \
--name CloudCoin_Wallet-Dark \
--description "CloudCoin Wallet - Dark Edition. Homepage: https//cloudcoin.global." \
--vendor "CloudCoin Consortium" \
--app-version 3.0.15 \
--input input --dest output --temp temp \
--icon icons/CloudCoin_Wallet-Dark.png \
--license-file license.txt \
--copyright "CloudCoin™ Global Consortium © 2020 The Future of Currency" \
--main-jar CloudCoin.D.3.0.15.jar \
--linux-deb-maintainer alang.hsu@gmail.com \
--linux-app-category misc \
--linux-shortcut