Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compile error

Status
Not open for further replies.

angelz

Programmer
Apr 23, 2002
9
GB
Hello all,

I'm very new to Java programming. I tried to compile 'webcrawler.java'. It gives me one error from this particular line( in bold), -->
public class webcrawler extends Applet implements ActionListener, Runnable {
public static final String SEARCH = "Search";
public static final String STOP = "Stop";
public static final String DISALLOW = "Disallow:";
public static final int SEARCH_LIMIT = 50;

Panel panelMain;
List listMatches;
Label labelStatus;

// URLs to be searched
Vector vectorToSearch;
// URLs already searched
Vector vectorSearched;
// URLs which match
Vector vectorMatches;

There error is;
Interface Actionlistener Of class webcrawler not found.

I have no idea what it means. Pls help me.......

Thanks in advance.
 
Have you got this at the top of the class
Code:
import java.awt.event.ActionListener;

or maybe
Code:
import java.awt.event.*;


If not, you need one of these.

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
Hi Timw,

Thanks for pointing it out. I reinstall JDK, set the classpath, & the error is gone. Well, not totally gone, now i hv other errors. :)

I got this applet from this link,

The errors I have now are are as belows....
Can anyone help me to understand on what's happening & what I need to do next? Pls....

Tq.

C:\>javac WebCrawler.java
WebCrawler.java:16: reference to List is ambiguous, both class java.util.List in
java.util and class java.awt.List in java.awt match
List listMatches;
^
WebCrawler.java:76: reference to List is ambiguous, both class java.util.List in
java.util and class java.awt.List in java.awt match
listMatches = new List(10);
^
WebCrawler.java:76: java.util.List is abstract; cannot be instantiated
listMatches = new List(10);
^
WebCrawler.java:77: cannot resolve symbol
symbol : method add (java.lang.String,java.util.List)
location: class java.awt.Panel
panelListCurrent.add("North", listMatches);
^
WebCrawler.java:207: cannot resolve symbol
symbol : method removeAll ()
location: interface java.util.List
listMatches.removeAll();
^
5 errors
 
What's happenig is that you're using a List object, and the compiler cannot tell if you're using java.util.List or java.awt.List. That's ambiguous but I think an

Code:
import java.util.List;

would do the trick.

Cheers,

Dian
 
Thanks a lot Dian, it works. :D
Now I understand that I hv to specify the reference if I got this kind of error.
But I still hv 3 more errors.
Why the compiler is telling me java.util.List is an abstract, and cannot be instantiated while I already declare it?
And the 'cannot resolve symbol' error....pls help me....

C:\>javac WebCrawler.java
WebCrawler.java:79: java.util.List is abstract; cannot be instantiated
listMatches = new List(10);
^
WebCrawler.java:80: cannot resolve symbol
symbol : method add (java.lang.String,java.util.List)
location: class java.awt.Panel
panelListCurrent.add("North", listMatches);
^
WebCrawler.java:210: cannot resolve symbol
symbol : method removeAll ()
location: interface java.util.List
listMatches.removeAll();
^
3 errors
 
Thanks Stefan & everyone that replied. I can compile this applet successfully...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top