tags:

views:

138

answers:

3

Hello,
I'm pretty new to Java ME and i'm trying to use Microlog to handle logging in my midlet.
In eclipse i can reference Microlog jars and it's all good in dev time,
but when i try to launch the application the jars aren't found on the device.
How can i bundle those referenced libs into my midlet?

Someone have any experience with using Microlog in a midlet?

Thanks.

+3  A: 

The classes are not found, because they are not inside the final MIDlet suite you are trying to run run in the device. In fact, you can't add external jars directly inside your midlet jar file as J2ME class loader is much more simple than the one in desktop Java. It only loads the classes found inside the midlet jar.

So, you have to extract everything from the Microlog jar and put them into you midlet jar just like you put your own classes and other resources. Probably you can configure your build tool to do this automatically for you.

Eclipse is able to find the classes because you have added the jar into your project's classpath.

Lauri
+2  A: 

Just a little addition. If you are using Eclipse to export the midlet you are able to generate the jar-file including all the classes of the dependencies for you.

Select "Java Build Path" of your project and then "Order and Export". Make sure the microlog jar-files are checked in that list. This will bundle everything into one jar-file.

Hope this helps.

Jarle Hansen
A: 

Hi,

I would recommend to use ProGuard to reduce the size of the final jar. Please read this article to figure out how to do it with Microlog:

http://myossdevblog.blogspot.com/2009/06/using-proguard-to-shrink-microlog.html

Johan Karlsson