Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find symbol

 
Sunder Ganapathy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • 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.
 
Cai DongShan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
Chandra Atla
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Yes Chandra,

I realised immediately after posting.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic