• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cannot resolve symbol

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Mulugeta Maru
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for not including the code:

Regrards,
Maru
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if you made this change, the compiler error message would surely be different. What is the error message now?
 
Mulugeta Maru
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're almost there!
remember "help" != "Help" and it compiles
 
Mulugeta Maru
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may well be a CLASSPATH issue. What is your CLASSPATH setting?
What happens when compiling with the following command?
javac -classpath . Hello.java
 
Mulugeta Maru
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic