This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes reusing classes meant for J2SE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "reusing classes meant for J2SE" Watch "reusing classes meant for J2SE" New topic

reusing classes meant for J2SE

Chong Zi Xin

Joined: Feb 23, 2005
Posts: 2
hello all,

I am new to J2ME and have a few questions to ask..

i have created some other classes meant for a J2SE application initially.
but now, i am thinking of writing a midlet for it as well.
so i would like to know if it is correct to say that i just need to write a midlet to replace my initial driver class of the J2SE version, not having to rewrite the codes for the other classes.

i tried zipping up all the necessary class files and putting it into the lib directory my project file in the WTK.

the following errors was what i got when attempting to build:-
on WTK2.2
ERROR: floating-point constants should not appear
Error preverifying class DefleaingService
Build failed

on WTK2.1
Error preverifying class Date
java/lang/NoClassDefFoundError: java/lang/Cloneable
Build failed

Date and DefleaingService are two of the classes in the zip file.
Certain floating point constants are defined in the classes. i understand that J2ME does not support float or double, is there anyway to overcome this limitation so that i could reuse my classes?
and also could anyone enlighten me as of why the two different versions of the WTK gave me different errors when building.

Please help..

Thanks alot in advance.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Remember that the J2ME APIs are a subset of J2SE and don't have all the classes. In MIDP 1.0 there was no floating point variables. There was MathFP a third party tool.

So some of those classes aren't available and would cause these errors. Like you said. The reason why you get different errors in different versions of WTK is because one is probably using MIDP 1.0 CLDC 1.0 and the other uses MIDP 2.0, CLDC 1.1


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Don't get me started about those stupid light bulbs.
subject: reusing classes meant for J2SE
jQuery in Action, 3rd edition