• Post Reply Bookmark Topic Watch Topic
  • New Topic

Packages??  RSS feed

 
Rohit chandra
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am having some problem in compiling packages. i will list down the directory structure below:
C:\Java\people\Person.java
C:\Java\people\employee\Employee.java
C:\Java\people\employee\Manager.java





Whenever i try comiling Employee.java, i get error as even though i have imported Person.java

C:\Java\people\employee>javac Employee.java
Employee.java:3: cannot resolve symbol
symbol : class Person
location: package people
import people.Person;
^
Employee.java:7: cannot resolve symbol
symbol : class Person
location: class people.employee.Employee
public class Employee extends Person
^
2 errors
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you compile Person as part of the people package, the qualified name becomes "people.Person.class," and this is located in the "Java" directory. So change the current directory to C:\Java. Then compile with...

C:\Java>javac people/Person.java
C:\Java>javac people/employee/Employee.java
[ December 04, 2007: Message edited by: marc weber ]
 
Rohit chandra
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.Could you please tell me how to compile the main method that exist in java directory.


I get error as

C:\Java>javac EmployeeTest.java
EmployeeTest.java:14: not a statement
System,out.println(mgr.getDetartment() + "Manager " + mgr.getNam
e() + "works in" + mgr.getDepartment());
^
EmployeeTest.java:14: ';' expected
System,out.println(mgr.getDetartment() + "Manager " + mgr.getNam
e() + "works in" + mgr.getDepartment());
^
2 errors


 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rohit chandra:
System,out.println...

Looks like a comma where there should be a period.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!