Hi *,
I'm new to
java and I'm having some issues compiling under certain conditions. I'm working with sun's jre 1.6 (including javac), so I think the reliance on classpath is not so heavy, but you all can correct me if I'm wrong.
Here's the situation:
I have these files in my directory: ~/proj/src/myPackage
class1.java
class2.java (has a main() in it and makes a reference to class1)
Both of these files begin with the line:
'package myPackage;'
I can build/debug this project in eclipse no problem. The problem comes when I try to invoke javac directly on class2.java. It gives me the 'cannot find symbol' for every reference to a variable of type class1 in class2.main() .
My Classpath is empty, and I've also tried compiling with:
javac -cp . class2.java
and it still doesn't work.
One thing that does seem to work is to simply remove the package statements from the top of class1.java and class2.java .
But... I want to declare these things in a package, so this is not a suitable workaround. i'd really like to know why this is happening.
(btw... I definitely have spelled the package name consistently, and I even tried changing my references to class1 to myPackage.class1 and even an import statement on that class- but every time javac still bombs with the cannot find symbol message)
Thanks! hw