This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Compilation Error: cannot resolve symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compilation Error: cannot resolve symbol " Watch "Compilation Error: cannot resolve symbol " New topic

Compilation Error: cannot resolve symbol

Prasath Thirumoorthy
Ranch Hand

Joined: Jul 23, 2004
Posts: 65
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,


S Thanigaivel
Ranch Hand

Joined: Oct 06, 2005
Posts: 60
both works fine my friend

i compiled both

check the spelling and character case
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

If your current directory is one directory above "bin" and you say "javac bin/", 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/

Third, you could compile both files at once:

javac bin/ bin/
[ October 07, 2005: Message edited by: Ernest Friedman-Hill ]

[Jess in Action][AskingGoodQuestions]
Prasath Thirumoorthy
Ranch Hand

Joined: Jul 23, 2004
Posts: 65
Thank u very much Mr Ernest Friedman-Hill

I agree. Here's the link:
subject: Compilation Error: cannot resolve symbol
It's not a secret anymore!