wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Cannot resolve symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Cannot resolve symbol" Watch "Cannot resolve symbol" New topic
Author

Cannot resolve symbol

Mulugeta Maru
Ranch Hand

Joined: Jan 20, 2003
Posts: 68
I am trying to compile hello.java that uses help.java and both of them are in the same directory. I can comile help but when I try to compile hello.java I get the following error message:
cannot resolve symbol
symbol : variable help
location: class hello
Your help is appreciated.
Regards,
Maru
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi,
Well, you'd have to show us your "hello.java". If the compiler thinks "help" is a variable, then it's not a problem with finding help.class; it's a syntax problem.


[Jess in Action][AskingGoodQuestions]
Mulugeta Maru
Ranch Hand

Joined: Jan 20, 2003
Posts: 68
Sorry for not including the code:

Regrards,
Maru
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

You have no class named "Help". You've got a file named Help.java, but it contains a class named "ServletUtilities". You can simply change "Help" to "ServletUtilities" to deal with the error.
The other problem here is that public classes are expected to be defined in a file named after them -- i.e., you should rename Help.java to ServletUtilities.java. Most likely you're already seeing a compiler warning about this.
Mulugeta Maru
Ranch Hand

Joined: Jan 20, 2003
Posts: 68
I did change help.java to ServletUtilities.java and the reference in Hello.java. I still can not compile Hello java. I can compile ServletUtilities no problem. Since this two files are in the same folder it should not have been a problem.
Any idea why I can not compile Hello.java?
Regrards,
Maru
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Well, if you made this change, the compiler error message would surely be different. What is the error message now?
Mulugeta Maru
Ranch Hand

Joined: Jan 20, 2003
Posts: 68
Sorry I did not respond on time. The error message is as follows:
hello.java:12: cannot resolve symol
symbol : variable help
location: class Hello
out.println(help.headWithTitle(title) +
I can compile help with no problem. It is when I try to compile hello the above error message is issued.


Regards,
Maru
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
You're almost there!
remember "help" != "Help" and it compiles


Mike Gershman
SCJP 1.4, SCWCD in process
Mulugeta Maru
Ranch Hand

Joined: Jan 20, 2003
Posts: 68
I must say thank you for trying to help me on this frustrating issue. I did change and now have the flowing code, which does give me the same error. I am not sure why. I did run the same code using BlueJ and it did compile no problem. I do not know why it does not compile when I do it at the command prompt. Any thoughts on this. I have not really used the command line very much. I am probably spoiled using BlueJ.


Regards,
Maru
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
If you still get the same error message
hello.java:12: cannot resolve symbol
symbol : variable help
location: class Hello
out.println(help.headWithTitle(title) +

then perhaps you're compiling old source from the command line.
If you are using the CD command to get to the directory, then typing

, do a to check the timestamps and code
Mulugeta Maru
Ranch Hand

Joined: Jan 20, 2003
Posts: 68
I still get the same error message. It does not make sense at all. I can compile Help but not Hello, because referece to Help. Both files are in the same directory. When I try to compile Hello, javac should have compile both automatically, because they are in the same folder.
When I use BlueJ no problem. It is only when I try to do it on a command line.
Thank you for you help.
Maru
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
This may well be a CLASSPATH issue. What is your CLASSPATH setting?
What happens when compiling with the following command?
javac -classpath . Hello.java


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Mulugeta Maru
Ranch Hand

Joined: Jan 20, 2003
Posts: 68
Thank you. You may be right to point out that it may be a CLASSPATH issue. I am getting package javax.servlet does not exist etc.
This is how I set-up my class path:

The two java programs I am trying to compile are in ...\webapps\ATS\WEB-INF\classes directory.
I am not sure whether my set-up is right.
What is not clear for me is that when I try to compile Help.java it does compile without an error. What is going on?
Regards,
Mulugeta
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot resolve symbol
 
Similar Threads
Package usage problem
class compile err,pls help
Help needed in RMI
How do I compile mt Tag Handler...?
still cant compile the code