Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A Package Question

 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic