[J2ME] how to use .jar?

Started by
3 comments, last by meow_altavista 17 years, 2 months ago
I have a .jar with some javadocs where i need to use it (it's a library) in my code. How to use a .jar in J2ME/java? do i just copy the .jar to the /src folder? help!
Advertisement
This might help: The Basics.

Dave
hi, thanks for the link, but my problem is that the package that i need to use is in a compiled .jar.

:(
1) Make sure the jar is MIDP compatible. If you're trying to use a J2SE lib then you will have problems as it will probably depend on classes not available in J2ME.

2) If the jar is compatible, then you need to include it in the classpath when you compile. From the command line this is accomplished with the -classpath argument for javac. For example (assuming a CLDC 1.0/MIDP 2.0 with no optional APIs):
javac    -bootclasspath [path to wtk\bin]\cldcapi10.jar;[path to wtk\bin]midpapi20.jar   -classpath [the jar you want to include]   -d tmpclasses   src\*.java


shmoove

EDIT: MIDP command line reference. Might come in handy.
oh i see. thanks shmoove!!!!

This topic is closed to new replies.

Advertisement