Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 546335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:51:23+00:00 2026-05-13T10:51:23+00:00

New to java… Trying to get a sample app to run. I’m including the

  • 0

New to java… Trying to get a sample app to run. I’m including the section of code that appears to be relevant to the issue. I can post the entire test app if needed. I

I’m trying to implement the errorhandler to handle the css warnings that are generated when the app is parsing targeted websites via the htmlunit lib/test that the app runs.

I’m not sure exactly how the MycssErrorHandler class should be implemented in order to invoke the ErrorHandler. I’m also not exactly sure how to instantiate the object in the main body of the code/test class.

Thoughts/Comments/Code chunks would be helpful..

Thanks!

I’m getting the following error when I compile:

[root@toshiba parseapp2]# javac -Xlint -classpath '/opt/htmlunit/lib/*:/parseapp2/' sjsu_classes.java

warning: [path] bad path element "/opt/htmlunit/lib/xml-apis.jar": no such file or directory
warning: [path] bad path element "/opt/htmlunit/lib/xercesImpl.jar": no such file or directory
warning: [path] bad path element "/opt/htmlunit/lib/serializer.jar": no such file or directory
sjsu_classes.java:92: sjsu_classes.MycssErrorHandler is abstract; cannot be instantiated
        ErrorHandler ierr = new MycssErrorHandler(); 
                        ^
1 error
3 warnings

====================================

The test code chunk is:

import org.w3c.css.sac.ErrorHandler;
    import com.gargoylesoftware.htmlunit.DefaultCssErrorHandler;
import org.xml.sax.SAXParseException;

public class sjsu_classes {

    //==handle the warnings thrown from the js functions..
    public static class MyIncorrectnessListener implements IncorrectnessListener
    {
      @Override
      public void notify(String arg0, Object arg1)
      {
        //System.err.println("Argument : " + arg0.toString() + ", Object : ");
      }
    }     

    //==handle the warnings thrown from the css functions..
//  public static class MycssErrorHandler implements DefaultCssErrorHandler
//  public static class MycssErrorHandler implements ErrorHandler
//  public class MycssErrorHandler implements ErrorHandler
    public abstract class MycssErrorHandler implements ErrorHandler
//  protected class MycssErrorHandler implements ErrorHandler
    {
      //@Override
      public void notify(String arg0, Object arg1)
      {
        //System.err.println("Argument : " + arg0.toString() + ", Object : ");
      }
      //@Override
        public void fatalError(SAXParseException ex)
        {
            //fatals.add(ex);
        }
    } 

    //public static void main(String[] args) throws Exception {
    public void main(String[] args) throws Exception {

        // Create and initialize WebClient object
//     WebClient webClient = new WebClient(BrowserVersion.EXPLORER_7);
       WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3);
           //WebClient webClient = new WebClient();

        IncorrectnessListener ilisten = new MyIncorrectnessListener(); 
        ErrorHandler ierr = new MycssErrorHandler(); 
        webClient.setIncorrectnessListener(ilisten); 
        webClient.setCssErrorHandler(ierr); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:51:23+00:00Added an answer on May 13, 2026 at 10:51 am

    Your MycssErrorHandler class is abstract, meaning that you can’t use it directly.

    An abstract class cannot be instantiated; it can only be inherited from.

    You need to remove the abstract keyword from the class definition.

    Once you remove the abstract keyword, you will also need to make your class implement all three method in the ErrorHandler interface. (error, fatalError, and warning)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 287k
  • Answers 287k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Stack Overflow uses such a function to determine the age… May 13, 2026 at 5:08 pm
  • Editorial Team
    Editorial Team added an answer Could this example be useful to you ? They use… May 13, 2026 at 5:08 pm
  • Editorial Team
    Editorial Team added an answer That looks fine, I'd suspect that the problem lies with… May 13, 2026 at 5:08 pm

Related Questions

Extremely new to Java an just playing around with it. I'm trying to add
I am new to Java and am trying to run a program using Eclipse.
I'm fairly new to Java (been writing other stuff for many years) and unless
I'm new to java development, and was happy to see how much easier the
I'm relatively new to java (specifically swing) and have recently been making some fairly

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.