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
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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: 438

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%] June 30th, 2010
If you find any post useful, click the "plus one" sign on the right
Frits Walraven
Rancher

Joined: Apr 07, 2010
Posts: 1043

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: 438

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
Rancher

Joined: Apr 07, 2010
Posts: 1043

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: 438

Thanks Frits
that helped
resolved
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: packages imported correctly but the source files are not getting compiled well from K & B chapter 10
 
Similar Threads
Access modifiers
Help with Package understanding
using the javac -cp command
package problems...
Package: resolving the class