wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes cannot find symbol -the subclass and supercalss are in the same directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "cannot find symbol -the subclass and supercalss are in the same directory " Watch "cannot find symbol -the subclass and supercalss are in the same directory " New topic
Author

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

zhy guo
Greenhorn

Joined: Aug 21, 2005
Posts: 3
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



[Thumbnail for err.JPG]

John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Try javac *.java
zhy guo
Greenhorn

Joined: Aug 21, 2005
Posts: 3
Thanks John Jai.
It work!
But why....
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
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
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

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
Bartender

Joined: May 31, 2011
Posts: 1776
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot find symbol -the subclass and supercalss are in the same directory