— Scott McNealy, Sun Microsystems Chairman, President and ceo



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

conse 
euguero-
PackageExercise.java
you’ll still compile 
from here
stay in the source directory! Do NOT cd down 
into the directory where the .java file is
!
compiles every source (.java) 
file in this directory
You MUST give the fully-qualified class name! The JVM will 
see that, and immediately look inside its current directory 
(classes) and expect to find a directory named com, where 
it expects to find a directory named headfirstjava, and in 
there it expects to find the class. If the class is in the “com” 
directory, or even in “classes”, it won’t work
!
you’ll still run 
from here
compile and run with 
packages


package, jars 
and
deployment
you are here
4
591
there are no
Dumb Questions
Q: 
I tried to cd into the 
directory where my main class 
was, but now the JVM says it can’t 
fi nd my class! But it’s right THERE 
in the current directory!
A: 
Once your class is in a 
package, you can’t call it by its 
‘short’ name. You MUST specify, 
at the command-line, the fully-
qualified name of the class whose 
main() method you want to run. 
But since the fully-qualified name 
includes the package structure, 
Java insists that the class be in a 
matching directory structure. So if 
at the command-line you say:
%java com.foo.Book
the JVM will look in its current 
directory (and the rest of its 
classpath), for a directory named 
“com”. It will not look for a class 
named Book, until it has found 
a directory named “com” with a 

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   541   542   543   544   545   546   547   548   ...   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