— Scott McNealy, Sun Microsystems Chairman, President and ceo



Download 40,57 Mb.
Pdf ko'rish
bet547/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   543   544   545   546   547   548   549   550   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

592
 
chapter 17
When your class is in a package, the package directory structure 
must be inside the JAR! You can’t just pop your classes in the 
JAR the way we did pre-packages. And you must be sure that you 
don’t include any other directories above your package. The 
fi rst directory of your package (usually com) must be the fi rst 
directory within the JAR! If you were to accidentally include the 
directory above the package (e.g. the “classes” directory), the JAR 
wouldn’t work correctly.
PackageExercise.class
classes
com
headfirstjava
101101 
10 110 1 
0 11 0 
001 10 
001 01 
Making an executable JAR with packages
JAR
Making an executable JAR
1
Make sure all of your class fi les are 
within the correct package structure, 
under the classes directory.
2
Create a manifest.txt fi le that states 
which class has the main() method, 
and be sure to use the fully-qualifi ed 
class name!
Make a text fi le named manifest.txt that has a
single line:
Main-Class: com.headfi rstjava.PackageExercise
Put the manifest fi le into the classes directory
3
Run the jar tool to create a JAR fi le 
that contains the package directories 
plus the manifest
%cd MyProject/classes 
%jar -cvmf manifest.txt packEx.jar com
packEx.jar
classes
manifest.txt
classes
com
headfirstjava
101101 
10 110 1 
0 11 0 
001 10 
001 01 
Main-Class: MiniApp
PackageExercise.class

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   543   544   545   546   547   548   549   550   ...   555




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish