• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

cannot find symbol -the subclass and supercalss are in the same directory

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.all the files are in the folder" I:\my codes\food\"
2.soure files:
1)B.java
package food;

public abstract class B extends Abc{
abstract void exit();
}

2)Abc.java
package food;

public abstract class Abc{
abstract void doit();
abstract void test();
}

3.before compile class B,class Abc is compiled successfully。then when trying to compile class B ,error raise :
b.java:3: cannot find symbol
symbol: class Abc
public abstract class B extends Abc{
^

1 error
err.JPG
[Thumbnail for err.JPG]
compiler error-cannot find symbol
 
Rancher
Posts: 1776
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try javac *.java
 
zhy guo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks John Jai.
It work!
But why....
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to consider the package structure when you compile and run.

So alternative way (or the correct one) is to compile like below -



Where food directory is present under C:/test
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Jai wrote:You have to consider the package structure when you compile and run.

So alternative way (or the correct one) is to compile like below -



Where food directory is present under C:/test


Yes, this is preferred way when you compile particular file.

and john mean while we can do using *.java if you go to the root package/food . I am curious to know the behind the sense of *.java even here also compiler have to do linking right?
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The listing for "Compiling multiple source files" here just tells that the wildcard option compiles all source files in the specified directory. I just copied the two source files in a different directory (not the directory 'food' with package name) but still was able to successfully compile them using * option.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic