BlackBerry problem using Java SE features

佐手、 提交于 2019-12-24 02:27:07

问题


I have imported net_rim_api.jar into my project. I also want to use non-j2me classes like StringTokenizer and PrintWriter from the standard rt.jar, but when I run the application it gives the error

"java/io/UTFDataFormatException" Duplicate class definition error.

How can i solve this problem?


回答1:


The class you mention is part of J2ME, so If you want to use non-J2ME classes (i.e. J2SE) that rely on a class of the same name (i.e. the J2SE equivalent class), you have a problem.

I'm not sure it's worth it, but if you can identify the full set of SE classes needed, and compile them from source using a different package name (something like my.java.io for example) you could port over the extra bits of functionality you need, and avoid the clash. You would be bringing a local clone of just the J2SE code needed into your project.




回答2:


The BlackBerry devices do not have a full Java runtime installed, so you have to constrain yourself to j2me and the extensions provided by RIM in net_rim_api.jar. You can't do what you want to do here.



来源:https://stackoverflow.com/questions/3976763/blackberry-problem-using-java-se-features

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