I'm using example code from the Apache documentation, shown here:
final WebClient webClient = new WebClient();
// Get the first page
final HtmlPage page1 = webClient.getPage("http://some_url");
// Get the form that we are dealing with and within that form,
// find the submit button and the field that we want to change.
final HtmlForm form = page1.getFormByName("myform");
final HtmlSubmitInput button = form.getInputByName("submitbutton");
final HtmlTextInput textField = form.getInputByName("userid");
// Change the value of the text field
textField.setValueAttribute("root");
// Now submit the form by clicking the button and get back the second page.
final HtmlPage page2 = button.click();
webClient.closeAllWindows();
I get errors from WebClient, HtmlPage, HtmlForm... basically, everything that should be imported from Apache, just isn't.
I've followed a bunch of guides on the web directing me on hwo to add external jars to my build path, and as far as I can tell, everything is set-up correctly. I've tried Cleaning the project, restarting Eclipse, closing/opening the project, etc. Nothing seems to work.
For reference, I downloaded the .JARs from this website: http://hc.apache.org/.
My import statements:
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
My error message:
[2014-06-23 12:43:55 - CampusHappenings] Dx 1 error; aborting [2014-06-23 12:43:55 - CampusHappenings] Conversion to Dalvik format failed with error 1
The entirety of the stacktrace is much too long to copy, but it's something to do with the htmlunit JARs themselves, not with my code. They all look something like this:
Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.xalan.lib.sql.SecuritySupport12$4) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format.
Thoughts? I'm so confused.