java htmlunit failing to load Javascript

Those are not errors, they are warnings.

They are caused by HtmlUnit's JavaScript engine Mozilla’s Rhino being unable to properly interpret some JavaScript code. (It is not as "good" as some other popular JS Engines.)

You can turn those warnings off, here's how:

public static void main(String[] args) throws Exception {
    // turn off htmlunit warnings
    java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.OFF);
    java.util.logging.Logger.getLogger("org.apache.http").setLevel(java.util.logging.Level.OFF);

    WebClient webClient = new WebClient();
    HtmlPage page = webClient.getPage("http://stackoverflow.com");
    System.out.println(page.getTitleText());
}

Output:

Stack Overflow

Tags:

Java

Htmlunit