— Scott McNealy, Sun Microsystems Chairman, President and ceo


-d fl ag, you get to decide which directory



Download 40,57 Mb.
Pdf ko'rish
bet538/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   534   535   536   537   538   539   540   541   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

-d
fl ag, you get to decide which directory the 
compiled code lands in, rather than accepting the default of 
class fi les landing in the same directory as the source code. 
To compile all the .java fi les in the source directory, use:
Running your code
run your program from 
the ‘classes’ directory. 
%javac -d ../classes *.java
*.java compiles ALL 
source files in the 
current directory
MyProject
source
classes
 
Lorper 
iure eugue 
tat vero 
conse 
eugueroLore 
do eliquis 
do del dip 
101101 
101101 
10101000010 
1010 10 0 
01010 1 
1010101 
10101010 
1001010101 
MyApp.java
MyApp.class
compile from 
THIS directory
compiled code 
lands here
run your main() 
from here 
(troubleshooting note: everything in this chapter assumes that the 
current working directory (i.e. the “.”) is in your classpath. If you 
have explicitly set a classpath environment variable, be certain 
that it contains the “.” )


package, jars 
and
deployment
you are here
4
585
Put your Java in a JAR
JAR fi le is a Java ARchive. It’s based on the pkzip fi le format, and it lets you bundle 
all your classes so that instead of presenting your client with 28 class fi les, you hand 
over just a single JAR fi le. If you’re familiar with the tar command on UNIX, you’ll 
recognize the jar tool commands. (Note: when we say JAR in all caps, we’re referring 
to the archive fi le. When we use lowercase, we’re referring to the jar tool you use to 
create JAR fi les.)
The question is, what does the client do with the JAR? How do you get it to run
You make the JAR executable.
An executable JAR means the end-user doesn’t have to pull the class fi les out before 
running the program. The user can run the app while the class fi les are still in the 
JAR. The trick is to create a manifest fi le, that goes in the JAR and holds information 
about the fi les in the JAR. To make a JAR executable, the manifest must tell the JVM 
which class has the main() method!

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   534   535   536   537   538   539   540   541   ...   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