Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Web Crawler (http://www.velocityreviews.com/forums/t146972-web-crawler.html)

Paul Morrison 10-17-2005 10:15 AM

Web Crawler
 
Hi

I got this web crawler from the Sun website
http://java.sun.com/developer/techni...ebCrawler.java,
but when trying to compile it, I get the following errors:

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 find symbol
symbol : method add(java.lang.String,java.util.List)
location: class java.awt.Panel
panelListCurrent.add("North", listMatches);
^
WebCrawler.java:207: cannot find symbol
symbol : method removeAll()
location: interface java.util.List
listMatches.removeAll();
^

Could this be because I am running a newer version of Java than this was
made of? Ive tried changing the type of listMatches to java.util.List, but
that just creates more problems.

Any help would be much appreciated.

--
Paul



Roedy Green 10-17-2005 10:32 AM

Re: Web Crawler
 
On Mon, 17 Oct 2005 11:15:12 +0100, "Paul Morrison" <pm42@kent.ac.uk>
wrote or quoted :

>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;
> ^


sounds like you imported both java.util.List and java.awt.List.

It does not know which one you mean. You have to fully quality it is
either.

java.awt.List listMatches;
or
java.util.List listMatches;

The problem could have come from a general import java.awt.*. Use
Eclipse or other IDE to split that into specific includes.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Andrew Thompson 10-17-2005 10:46 AM

Re: Web Crawler
 
Paul Morrison wrote:
> Hi
>
> I got this web crawler from the Sun website
> http://java.sun.com/developer/techni...ebCrawler.java,
> but when trying to compile it, I get the following errors:
>
> WebCrawler.java:16: reference to List is ambiguous, both class
> java.util.List in java.util and class java.awt.List


What Roedy said (especially about making explicit imports) +
....
> ..Ive tried changing the type of listMatches to java.util.List,


...that's the wrong one. It is after an java.awt.List in that code.

Also, if you're using 1.5, it should show a 'deprecated' warning,
that is because of

'f.show();'

...update that to..

'f.setVisible(true);'

...and the code should be 'OK to go'.

I'm not sure if Roedy mentioned, but he has a wonderful collection
of 'quick help' on all manner of compilation and run time errors
at his site, you can find them LINKED from the bottom of the
section here..
<http://www.physci.org/codes/javafaq.jsp#exact>

...also, a better group for beginner programmers might be..
<http://www.physci.org/codes/javafaq.jsp#cljh>

HTH

lamantpirate 06-30-2012 04:17 PM

Hi, my solution is
 
Quote:

Originally Posted by Paul Morrison (Post 631279)
Hi

I got this web crawler from the Sun website
http://java.sun.com/developer/techni...ebCrawler.java,
but when trying to compile it, I get the following errors:

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 find symbol
symbol : method add(java.lang.String,java.util.List)
location: class java.awt.Panel
panelListCurrent.add("North", listMatches);
^
WebCrawler.java:207: cannot find symbol
symbol : method removeAll()
location: interface java.util.List
listMatches.removeAll();
^

Could this be because I am running a newer version of Java than this was
made of? Ive tried changing the type of listMatches to java.util.List, but
that just creates more problems.

Any help would be much appreciated.

--
Paul


So, i have the same problem, and i found a little solution :

change this line16 "List listMatches;" with this one : "java.awt.List listMatches;"
and
change the line77 "listMatches = new List(10);" with : "listMatches = new java.awt.List(10);"


thats will work.


All times are GMT. The time now is 12:50 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.