This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes A Package Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A Package Question" Watch "A Package Question" New topic
Author

A Package Question

Arul Jose
Ranch Hand

Joined: Jan 14, 2005
Posts: 131
I could not come to a conclusion why the class TestInterfaceMember is not compiling. Please see if you can help.

[aruljose@aruljose javatry]$ javac -classpath ./classes:. TestInterfaceMember.java
TestInterfaceMember.java:2: cannot find symbol
symbol : class pkg
location: class test
class TestInterfaceMember implements test.pkg.I
^
TestInterfaceMember.java:2: interface expected here
class TestInterfaceMember implements test.pkg.I
^
TestInterfaceMember.java:6: cannot find symbol
symbol : variable i
location: class TestInterfaceMember
System.out.println(i);
^
3 errors
[aruljose@aruljose javatry]$ ls classes
test/
[aruljose@aruljose javatry]$ ls classes/test/
pkg/
[aruljose@aruljose javatry]$ ls classes/test/pkg/
I.class

TestInterfaceMember.java


classes/test/pkg/I.java
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Your "ls" shows only the class file in classes/test/pkg. My guess is that it's an outdated class file that actually represents a class named I. Delete the class file, put the source file in its place, and use the same compile command; things should work just fine.


[Jess in Action][AskingGoodQuestions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: A Package Question