-1

i have these codes

    UserAgentContext uAgent=new SimpleUserAgentContext();
    DocumentBuilderImpl docBuild=new DocumentBuilderImpl(uAgent);
    docBuild.parse(new InputSourceImpl("http://dic.amdz.com/"));

when i run , it gives me the following error:

Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface sun.font.FontManager, but class was expected
    at org.lobobrowser.util.gui.FontFactory.createFont(FontFactory.java:210)
    at org.lobobrowser.util.gui.FontFactory.createFont_Impl(FontFactory.java:180)
    at org.lobobrowser.util.gui.FontFactory.createFont(FontFactory.java:127)
    at org.lobobrowser.util.gui.FontFactory.getFont(FontFactory.java:98)
    at org.lobobrowser.html.style.StyleSheetRenderState.<clinit>(StyleSheetRenderState.java:43)
    at org.lobobrowser.html.domimpl.NodeImpl.<clinit>(NodeImpl.java:39)
    at org.lobobrowser.html.parser.DocumentBuilderImpl.createDocument(DocumentBuilderImpl.java:143)
    at org.lobobrowser.html.parser.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:97)
    at cobratest2.Cobratest2.main(Cobratest2.java:21)

then pointing me to the last line. so the question is, what to do?

lonesome
  • 2,503
  • 6
  • 35
  • 61
  • The same post http://stackoverflow.com/questions/1980452/what-causes-java-lang-incompatibleclasschangeerror – e-zinc Jan 19 '12 at 06:59
  • @lonesome: it's a stack of method called before exception occured. if you want to know deeper: http://java.sun.com/developer/technicalArticles/Programming/Stacktrace/ – Azodious Jan 19 '12 at 07:06
  • @Azodious well i read the link, my program is totally that 3 lines. i dont think if there is any of the explained ways in the link that would work with it... – lonesome Jan 19 '12 at 07:12
  • @e-zincu gotta be joking,,, same post? i didnt see any similarity – lonesome Jan 19 '12 at 07:14

1 Answers1

2

The problem is at

org.lobobrowser.util.gui.FontFactory.createFont(FontFactory.java:210)

That class was compiled against an old version of the libraries in whichsun.font.FontManager was a class, but you are trying to run it with newer libraries in which it is now an interface. You will probably have to recompile all of the org.lobobrowser package against current libraries.

And BTW, the link What causes java.lang.IncompatibleClassChangeError? mentioned by e-zinc does contain all the information you need to have figured this out yourself.

Community
  • 1
  • 1
Jim Garrison
  • 85,615
  • 20
  • 155
  • 190
  • but the thing made me confuse is that i using the library of last version with the same version of documentation,,,so it shouldnt be changed, i just cant get it why it has changed, cause i just added the library and followed the documents to code my program – lonesome Jan 19 '12 at 08:31
  • This could happen if the `org.logobrowser` library was built against an earlier version of Java than the program that uses it. – Jim Garrison Jan 21 '12 at 02:08