0

I am trying to write code in Processing (basically Java) that will get the information from the table here: http://science.nasa.gov/iSat/iSAT-text-only/

I have not started writing the code specific to the table yet because I can't even get this to run. I get the error "type String is ambiguous." I cannot find any duplicate of String nor can I think of any other reason for this error.

import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.*;
import java.net.*;

WebClient client = new WebClient(BrowserVersion.CHROME);
try {
    java.lang.String url = "http://science.nasa.gov/iSat/iSAT-text-only/";
    Page page = client.getPage(url);
    println(page.getWebResponse().getContentAsString());
}
catch(IOException e) {
    println("oops!");
}

UPDATE: I modified the code slightly and got it to get the information I want using the following code in eclipse:

WebClient client = new WebClient();
String url = "http://science.nasa.gov/iSat/iSAT-text-only/";
HtmlPage page = null;
try {
    page = (HtmlPage) client.getPage(url);
} catch (FailingHttpStatusCodeException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
client.waitForBackgroundJavaScript(10000);
System.out.print(page.asXml());     

but it still throws the ambiguous String error in Processing.

SaJaK
  • 1
  • 2

1 Answers1

0

Bizarrely, manually importing java.lang.String fixed the error.

SaJaK
  • 1
  • 2