difference between Sun JDK and open JDK

人盡茶涼 提交于 2019-12-14 01:28:23

问题


I am running into errors such as the following:

Exception in thread "Thread-1" java.lang.IncompatibleClassChangeError: Found class com.sun.image.codec.jpeg.JPEGImageEncoder, but interface was expected

I have built my JAR's using Sun JDK and I am running on OpenJDK. I am kind of stuck with this environment.

Is there an easy way around this? Do I have to compile and run the code on OpenJDK?


回答1:


com.sun.image.codec.jpeg.JPEGImageEncoder by the name is a Sun-specific package so there's no guarantee (in fact it's highly unlikely) that any other JDK\JRE will provide that class. Are you using it directly? If so, you're limiting your application to Sun-only JVMs.




回答2:


By the looks of it, Jasper Reports is drilling down and using internal classes / methods that it shouldn't use. This apparently doesn't work on all platforms ... which is not surprising because Sun / Oracle specifically state that doing this is liable to break.

What should you do?

  • Check the Supported Platforms datasheet. I note that it lists OpenJDK 6, but not OpenJDK 7. Maybe you should stick with the JasperSoft supported platforms.

  • I found this page which seems to talk about this problem ... or something rather similar ... and offers a workaround.



来源:https://stackoverflow.com/questions/15260446/difference-between-sun-jdk-and-open-jdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!