— Scott McNealy, Sun Microsystems Chairman, President and ceo



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

organizing your 
classes
584
 
chapter 17
%cd MyProject/classes
%java Mini
%cd MyProject/source
%javac -d ../classes MyApp.java
Separate source code and class files
A single directory with a pile of source code and class fi les is a 
mess. It turns out, Bob should have been organizing his fi les 
from the beginning, keeping the source code and compiled 
code separate. In other words, making sure his compiled class 
fi les didn’t land in the same directory as his source code.
The key is a combination of directory structure organization and the 
-d 
compiler option.
But I thought I didn’t have 
a choice about putting the class 
fi les in with the source fi les. 
When you compile, they just 
go 
there, so what do I do?
There are dozens of ways you can organize your fi les, and your 
company might have a specifi c way they want you to do it. We 
recommend an organizational scheme that’s become almost 
standard, though.
With this scheme, you create a project directory, and inside 
that you create a directory called source and a directory called 
classes. You start by saving your source code (.java fi les) into 
the source directory. Then the trick is to compile your code 
in such a way that the output (the .class fi les) ends up in the 
classes 
directory.
And there’s a nice compiler fl ag, 
-d
, that lets you do that.
Compiling with the 
-d
(directory) fl ag
tells the compiler to put the 
compiled code (class files) 
into the “classes: directory 
that’s one directory up and 
back down again from the 
current working directory.
the last thing is still 
the name of the java 
file to compile
By using the 

Download 40,57 Mb.

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