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
Duplicate class definition error.
How can i solve this problem?
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.
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.