Web Crawler

Discussion in 'Java' started by Paul Morrison, Oct 17, 2005.

  1. Hi

    I got this web crawler from the Sun website
    http://java.sun.com/developer/technicalArticles/ThirdParty/WebCrawler/WebCrawler.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
     
    Paul Morrison, Oct 17, 2005
    #1
    1. Advertising

  2. Paul Morrison

    Roedy Green Guest

    On Mon, 17 Oct 2005 11:15:12 +0100, "Paul Morrison" <>
    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.
     
    Roedy Green, Oct 17, 2005
    #2
    1. Advertising

  3. Paul Morrison wrote:
    > Hi
    >
    > I got this web crawler from the Sun website
    > http://java.sun.com/developer/technicalArticles/ThirdParty/WebCrawler/WebCrawler.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
     
    Andrew Thompson, Oct 17, 2005
    #3
  4. Paul Morrison

    lamantpirate

    Joined:
    Jun 30, 2012
    Messages:
    1
    Hi, my solution is


    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.
     
    lamantpirate, Jun 30, 2012
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sanjay Patra

    Web Crawler

    Sanjay Patra, Nov 17, 2004, in forum: C++
    Replies:
    2
    Views:
    757
  2. abhinav

    web crawler in python or C?

    abhinav, Feb 16, 2006, in forum: Python
    Replies:
    13
    Views:
    1,292
  3. Sanjay Patra

    C Web crawler code

    Sanjay Patra, Nov 18, 2004, in forum: C Programming
    Replies:
    1
    Views:
    1,531
    Raymond Martineau
    Nov 18, 2004
  4. abhinav

    web crawler in python or C?

    abhinav, Feb 16, 2006, in forum: C Programming
    Replies:
    1
    Views:
    1,427
  5. Oscarian

    Web crawler

    Oscarian, Jan 11, 2007, in forum: C Programming
    Replies:
    5
    Views:
    627
    Oscarian
    Jan 12, 2007
Loading...

Share This Page