P
Philipp Gressly
exquisitus said:I have a simple test package that I am using to learn Java. I have two
files, both of which belong to the same package (mypackage). One of the
files uses a class defined in the other file. Both files are in the same
directory c:\temp\test\mypackage
I compiled the non-dependent file without any problem. However, when I
tried to compile the file that has a dependency to the other file, I got
a "cannot resolve symbol". I don't believe it!. The .class file from
the first compilation is right there (where on earth is the compiler
looking)?. I tried to spoonfed the compiler by typing the ff (from the
c:\temp\test\mypackage directory):
javac -c . foo2.java
and it still reported the same error !
This must be fairly easy to solve. I would appreciate any help. As an
aside, could anyone provide me with a simple build.xml file to build
this?. The two files are foo1.java and foo2.java. foo2.java has
adependency on foo1.java
Thanks
Try the following javac-command with the below mentioned classes
"Foo1.java" and "Foo2.java" (be aware of the package-declaration, the
upper- and lowercase Letters in the File- and Classnames and the
classpath and local directory:
cd C:\temp\test
javac -classpath . mypackage/*
File Foo1.javaackage mypackage;
public class Foo1 {
Foo2 foo2;
}
<<<
File Foo2.javapackage mypackage;
public class Foo2 {
}
<<<
Hope that hepls