aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes packages imported correctly but the source files are not getting compiled well from K & B chapter 10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "packages imported correctly but the source files are not getting compiled well from K & B chapter 10" Watch "packages imported correctly but the source files are not getting compiled well from K & B chapter 10" New topic
Author

packages imported correctly but the source files are not getting compiled well from K & B chapter 10

Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

I was trying a little experiment with the source files in different packages
but I am getting following errors
this is my directory structure and the programs also are given below

Directory structure is


following are the source files


and when I compile the program using commands then I get following error messages


please help me


SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1696
    
  25

Hi Prasad,

javac JarDemo/first/B.java
JarDemo\first\B.java:7: cannot find symbol

B.java uses something from class C.java, so you have to give the path to the compiler when compiling class B

you have to use the command javac -cp

have a look at my notes (SCJP Faq) chapter 10

Regards,
Frits
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

I tried like you said but it is not working
I know I have made mistake but can't figure out where
and I could not find any satisfactory answer in the link you provided
I tried following commands now
but not working
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

For static members, you should use static imports, like,



|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1696
    
  25

Hi Prasad,

Change the following method call (in public class A)
into

Change the following method calls (in public class B)
into

then compile with the package dir as a subdir (i.e. from your root):
javac JarDemo\first\subFirst\C.Java JarDemo\first\B.java JarDemo\A.java

Regards,
Frits

Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

Thanks Frits
that helped
resolved
 
jQuery in Action, 2nd edition
 
subject: packages imported correctly but the source files are not getting compiled well from K & B chapter 10