2 Replies Latest reply: May 10, 2010 11:00 AM by 843810 RSS

    java compiler question

      I am trying to compile two classes, "Table.java" and "Person.java", that are both in a package called "dinnerObjects". I am trying to reference the Table class in the other class, Person.

      The class Table.java compiles successfully.

      When I compile from command line, using "javac Person.java" while in the directory "dinnerObjects", I get the error:
      $ javac Person.java
      Person.java:14: cannot find symbol
      symbol  : class Table
      location: package dinnerObjects
      import dinnerObjects.Table;
      I have seen people using "javac -cp..." and don't know what this does.

      In the class Person, I use:
      package dinnerObjects;
      import dinnerObjects.Table;
      and likewise in the class Table, I use:
      package dinnerObjects;
      import dinnerObjects.Person;
      Am I doing something wrong in Person.java? Or should I be using "javac -cp"?

      Please let me know!! Thanks!