Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compilation Error: cannot resolve symbol

 
Prasath Thirumoorthy
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

Consider this is simple examples.

i have created 2 class in the bin directory.

public class Example1 {
}
public class Example2{
Example1 ex1 = new Example1();
}

I tried to compile these 2 files.Example1 is compiled fine.
I tried to compile the class Example2 it giving compilation error:
cannot resolve symbol class Example1

Please help me out what the mistake i had done.Whats the reason for the compilation error?

Help me !

Thanks & Regards,
Prasath
 
S Thanigaivel
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
both works fine my friend

i compiled both

check the spelling and character case
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your current directory is one directory above "bin" and you say "javac bin/Example2.java", the compiler will not look in "bin" for Example1, and you'll get a compiler error. There are three ways to deal with this. First, you could compile with "bin" as your current directory. Second, you could tell the compiler that "bin" is a directory in which to find other classes:

javac -cp bin bin/Example2.java

Third, you could compile both files at once:

javac bin/Example1.java bin/Example2.java
[ October 07, 2005: Message edited by: Ernest Friedman-Hill ]
 
Prasath Thirumoorthy
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank u very much Mr Ernest Friedman-Hill

regards,
Prasath
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic