• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Cannot find symbol

 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While compiling the source code in Page 84 of HFSJ, I get cannot find symbol
message for the following lines.
List result = be.getbrands(c);
Iterator it = result.iterator();
I use JDK 1.5.0_0 & Tomcat 5.0.16.

I tried List<String> result = be.getBrands(c); &
Iterator<String> it = result.iterator();

Still the compilation fails.

Could anybody explain.

Thanks.
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sunder,

What is compiling command? I use the following command (it is only one line) to compile without problem.



Note: C:\Program Files\Apache Software Foundation\Tomcat 5.5 is my Tomcat root

I installed jdk-1_5_0_04-windows-i586-p.exe and jakarta-tomcat-5.5.9.exe on my PC.
 
Sunder Ganapathy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My compilation command is as follows. I am having Win XP.

javac -classpath c:/tomcat/common/lib/servlet-api.jar;classes;. -d classes src/com/example/web/BeerSelect.java

I also tried with -deprecation, but still the error persists.
 
Sunder Ganapathy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The command and messages are as follows.

javac -deprecation -classpath c:/tomcat/common/lib/servlet-api.jar;classes;. -d classes src/com/example/web/BeerSelect.java

src/com/example/web/BeerSelect.java:29: cannot find symbol
symbol : class List
location: class com.example.web.BeerSelect
List<String> result = be.getBrands(c);
^
src/com/example/web/BeerSelect.java:31: cannot find symbol
symbol : class Iterator
location: class com.example.web.BeerSelect
Iterator<String> it = result.iterator();
^
2 errors
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you need to import java.util.* in your code.

Thanks,
Chandra
 
Sunder Ganapathy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Chandra,

I realised immediately after posting.
 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic