Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Prasad Kharkar
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2445
96
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For static members, you should use static imports, like,

 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2445
96
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frits
that helped
resolved
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic