aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Cannot find symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Cannot find symbol" Watch "Cannot find symbol" New topic
Author

Cannot find symbol

Sunder Ganapathy
Ranch Hand

Joined: Apr 01, 2003
Posts: 120
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

Joined: Dec 07, 2004
Posts: 102
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.


Best Regards,<br />DongShan<br /> <br />SCJP1.4, SCWCD1.4
Sunder Ganapathy
Ranch Hand

Joined: Apr 01, 2003
Posts: 120
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

Joined: Apr 01, 2003
Posts: 120
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

Joined: Jul 21, 2004
Posts: 91
I think you need to import java.util.* in your code.

Thanks,
Chandra
Sunder Ganapathy
Ranch Hand

Joined: Apr 01, 2003
Posts: 120
Yes Chandra,

I realised immediately after posting.
 
wood burning stoves
 
subject: Cannot find symbol