This discussion is archived
2 Replies Latest reply: Sep 28, 2010 12:28 PM by 801348 RSS

Cannot find symbol error when compiling in different packages

801348 Newbie
Currently Being Moderated
Hey all,

I'm trying to divide my project into a sensible hierarchy. This is what I want:
MyProject/src ................................. where all the source files are (no further directories)
MyProject/classes/classes2 ................ sorry for not being creative XD
Now, Age uses Main, and this is where the trouble is. I'm using javac directly to compile Age, and this is how I'm doing it:
//from MyProject
javac -cp classes src/
And I get this error:
bla bla bla...cannot find symbol
symbol  : variable Main
location: class classes2.Age
          years = (byte)(Main.year - m.getYear());
Main is already compiled and in place.

Also, this is how starts:
package classes2;

public class Age
I'm using JCreator as an IDE (and using it's own build function, the same error occurs, which is why I tried directly compiling the file).

Why can't javac find Main.class? I tried searching Google, but my particular problem didn't seem to crop up.

Hope I provided enough information, and ask if more is needed.

Many thanks :)


  • Correct Answers - 10 points
  • Helpful Answers - 5 points