aspose file tools*
The moose likes Java Micro Edition and the fly likes Packaging 3rd party .jars Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Packaging 3rd party .jars" Watch "Packaging 3rd party .jars" New topic
Author

Packaging 3rd party .jars

Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
How should one package his application which consists of the application code and a 3rd party .jar file such as kxml.jar? Are there tools for this?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Fred Grott
Ranch Hand

Joined: Oct 05, 2002
Posts: 346
Originally posted by Lasse Koskela:
How should one package his application which consists of the application code and a 3rd party .jar file such as kxml.jar? Are there tools for this?

an old trick is to use winzip to unpack the kxml.jar jar..
Remember jars are just enhanced zip files..now that is somewhat oversimplistic in some cases btu for here on this case works very nice..


MobileBytes blog - Sharing Technology - My Programming Knols
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Fred Grott:
An old trick is to use winzip to unpack the kxml.jar jar.

So there is no "clean" way to include several .jar files into a single "J2ME package"? Ok. I'm fine with exploding the kxml.jar but am a bit surprised there is no way to reference external .jars or something like that.
Well, thanks. I'll go explode some .jars...
Greg Schwartz
Ranch Hand

Joined: May 11, 2003
Posts: 132
If you put the jar or zip file in your projects /lib directory, the class files in the jar or zip will be deployed upon building. When you package your application those external class files will be included.


Greg Schwartz<br />Mobatech, LLC<br />greg@mobatech.com<br /><a href="http://www.mobatech.com" target="_blank" rel="nofollow">www.Mobatech.com</a>
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Greg Schwartz:
If you put the jar or zip file in your projects /lib directory, the class files in the jar or zip will be deployed upon building. When you package your application those external class files will be included.

Umm... Sounds great but which "project's lib directory" are you talking about? Some specific IDE perhaps?
Greg Schwartz
Ranch Hand

Joined: May 11, 2003
Posts: 132
Sun's WTK has a folder for the application you are working on called "apps" and a "lib" folder within that "apps" folder. You can put the 3rd party jar in that lib directory.
I used a 3rd party class file for floating point math in one of my applications. I ended up having better luck using a zip file instead of a jar. I had to take the .class file out of the jar and put it in a .zip file in the /apps/APP_NAME/lib directory.
Motorola's iDEN IDE has an npclass and pclass folder. I think you need to get the class files out of the archived jar and place them in the npclass folder before building the application.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Thanks Greg.
I'm using Sun ONE Studio Mobile Edition, which is based on the Wireless Toolkit -- would you happen to know about that IDE's peculiarities? At least the lib folder isn't created by default (I'll re-check that though).
Greg Schwartz
Ranch Hand

Joined: May 11, 2003
Posts: 132
I think you may have to create the lib directory manually. I would try that first.
If that doesn't work, let me know what directories are provided in your specific apps directory (the one pertaining to the project you're working on).
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Hi Greg. Thanks for the tips but I ended up with Antenna.
Works great (well, except for the small weirdness that I am not able to preverify unless I run the code through an obfuscator first?), integrates with IDEs (via the Ant script), and doesn't let me mess up the build process by clicking the wrong buttons in a GUI. Oh, and it includes the 3rd party .jars for me
[ May 28, 2003: Message edited by: Lasse Koskela ]
 
wood burning stoves
 
subject: Packaging 3rd party .jars