Saya memiliki struktur folder ini:
D: \ JavaProjects \ OlivePressApp \ com \ lynda \ olivepress \ Main.class D: \ JavaProjects \ OlivePressApp \ com \ lynda \ olivepress \ tekan \ OlivePress.class D: \ JavaProjects \ OlivePressApp \ com \ lynda \ olivepress \ zaitun \ Kalamata .class D: \ JavaProjects \ OlivePressApp \ com \ lynda \ olivepress \ olives \ Ligurian.class D: \ JavaProjects \ OlivePressApp \ com \ lynda \ olivepress \ olives \ Olive.class
Main.class
dalam paket com.lynda.olivepress
Ada dua paket lain:
com.lynda.olivepress.press
com.lynda.olivepress.olive
1) Buat file "Manifest.txt"
dengan nama Two Lines, First with Main-Class dan Second Empty Line.
Main-Class: com.lynda.olivepress.Main
D: \ JavaProjects \ OlivePressApp \ Manifest.txt
2) Buat JAR dengan Manifest dan Entry Point Kelas Utama
D: \ JavaProjects \ OlivePressApp>jar cfm OlivePressApp.jar Manifest.txt com/lynda/olivepress/Main.class com/lynda/olivepress/*
3) Jalankan JAR
java -jar OlivePressApp.jar
Catatan: com/lynda/olivepress/*
berarti termasuk dua paket lain yang disebutkan di atas, sebelum poin 1)