• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Converting MIDP suites to .PRC files

 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recently downloaded MIDP for Palm from the Net and so far have installed every thing successfully, including the example midlets to my handheld. However, when trying to use the Converter tool to converte a midlet suite (.jar/.jad) files to the Palm .PRC format, I get the following error:
File:/home/layne/code/java/midlets/WelcomeJar/Welcome.jad Result:Failed: The .JAR file cannot be converted as critical information is missing or formatted incorrectly. Try downloading the file again or contact the application provider. ErrCode=1070
This midlet runs just fine with the MIDP implementation from Sun on my Linux box. I got it from the Core J2ME book.
So I'm not sure why I'm getting this error or how to fix it. Does anyone out there have any ideas or suggestions?
Thanks in advance.
Layne
[ March 27, 2003: Message edited by: Layne Lund ]
 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(1) i did not even know you could connect a palm to a linux desktop - coool.
(2) do you have the entire code of that app? please post it here if possible.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by a sanjuan:
(1) i did not even know you could connect a palm to a linux desktop - coool.


Yup, there are several utilities to synch a Palm-based device with Linux. I am currently using one called JPilot. You can also find names of similar apps in my thread on this topic in the Linux board, if you are interested. This has also been convenient because my current Java development has been completely in Linux.


(2) do you have the entire code of that app? please post it here if possible.


You asked for it




I ran the following commands to compile and preverify the midlets:

I used similar commands to compile and preverify the WelcomeBack class as well. Finally, I created the jar file with the following:

The pclasses directory contains the preverified class files and resources should contain the .png files, except I didn't have them at the time I originally created the jar file. (As I said, this is an example from the Core J2ME book.)
Also, it has been a while since I originally created the jar file. I'm pretty sure it ran on the MIDP emulator just fine, but maybe I should test that again. It looks like I have two copies of the code also, so I should probably start over to make sure I'm using a fresh jar file with the PRC conversion tool.
Even then, I am doubtful that I will have any positive results. Any suggestions you may have will be greatly appreciated.
Thanks,
Layne
 
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can not only use Linux to develop Palm applications, you can also establish PPP links between the linux host the Palm device so that the PDA can access the Internet. Linux (vi and ANT) has been my J2ME development environment from day one.
Nokia has released a Linux toolkit and emulator for their MIDP devices. There are J2ME specific ANT tasks too. I will have an article coming up on Forum Nokia in the next couple weeks discussing how to integrate ANT with the Nokia Linux toolkit.
OK, back to your Palm question: The RPC conversion tool for Palm OS is very old and buggy. I have not used it since I got my new PocketPC phone edition (I can run both MIDP and PersonalJava on PPC). But I tend to remember that it cannot handle too large JAR files since their is a limit for "record length" in the underlying Palm OS ...
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your input. As you can see from the source code, the jar file shouldn't be too large. This is basically the midlet version of "Hello, World." I don't think that is the problem at all. So far I have been able to install Java HQ, the Java VM for Palm, and the example apps that came with midp4palm. Of course, these were already converted into prc files. Now for some reason, the Welcome.jar file cannot be converted to a prc file. (See the above error message.)
I'll keep working on this on the weekend, but more suggestions are greatly appreciated.
Layne
 
Michael Yuan
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like that you were using the MIDP v2.0 RI? As I understand it, Palm only supports MIDP v1.0 and your JAD files says the app is MIDP v1.0. That might be the problem?
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ooo...Good point. I hadn't considered version differences. I'm actually not sure which version of MIDP I am using. I'll take a closer look when I get home tonight. BTW, how do I check the version? Is there a -version flag?
 
Michael Yuan
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Layne Lund:
ooo...Good point. I hadn't considered version differences. I'm actually not sure which version of MIDP I am using. I'll take a closer look when I get home tonight. BTW, how do I check the version? Is there a -version flag?


Actually, I think you were using the MIDP v2.0 base class libraries because you used this command:
javac -bootclasspath /usr/java/midp2.0fcs/classes Welcome.java
I would install the MIDP libraries in user directories so that I can mess around without breaking the main Java installation.
cheers
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahh, the version happens to be in the directory name. So do I need to download MIDP1.0 or is there a way to compile a 1.0-only midlet with the installation I currently have (which is apparently 2.0)?
 
Michael Yuan
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to download and link your app against MIDP v1.0 RI. There is no "command line option" you can use. But again, I cannot promise that swtiching to v1.0 would solve your problem.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a strong hunch that it will fix the problem, since as you mentioned, Palm only supports MIDP 1.0. At the very least, I will try it. Even if it doesn't work, I'll at least eliminate that possibility.
Doh! I forgot to bring a ZIP disk with me to campus, and the bookstore is closed today Either I have to dl it tomorrow or go home and get a disk... *sigh*
[ March 30, 2003: Message edited by: Layne Lund ]
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, I installed MIDP 1.0.3, but I still get the same error when trying to convert to a .prc file. Here are the commands I use to compile my .java files and create the .jar file:

I didn't change the CLDC installation, though, so maybe the problem is with that now? Does anyone have any other suggestions?
Thanks in advance,
Layne
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I still haven't resolved this problem with the PRC Converter tool. See the first message in the thread for the exact error message it gives me. I'd sure appreciate any help with this, if anyone has any additional suggestions.
Thanks,
Layne
 
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mentioned running it in an emulator - was that Palm's or the generic one from Sun?
I'm guessing it was Sun's 'cause I think the Palm emulator requires .prc files. Let me take a look around when I get home and I'll see what I had to do to convert the files...
BTW, the Convert program is from Palm, isn't it?
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yah, it is Sun's emulator. I've been sucessful compiling and running some example midlets with Sun's implementation of MIDP 2.0. It's been a while since I worked on this, but I think I tried MIDP 1.0 as well, since that's all that is currently supported on the Palm platform. I'm not sure if I changed my CLDC installation, though.
I guess I need to go back over this so I can have more details for you about what I've tried. I've gotten off on other projects, so this hasn't been a priority lately. I'd definitely like to keep exploring J2ME further, so any more input will be fine.
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I looked up the error in the user.pdf document that came with the MIDP4Palm zip fril from Sun, and here's what is says:

Problem � You receive the following error message:
The .JAR file cannot be converted as critical information is missing or formatted incorrectly. Try downloading the file again or contact the application provider.
The MIDP Specification 1.0 requires a JAR file to have a certain properties in a certain format. The PRC Converter Tool will not convert a JAR file that does not follow this requirement of the specification.


Not very helpful, eh. However, I suspect that it may be complaining about the manifest file since that's the only thing I know of that might require specific information in a specific order.
I hope this helps...
Burk
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I looked in the user.pdf that came with the MIDP4Palm zip from Sun and found this about the message:

The .JAD file cannot be converted as critical information is missing or formatted incorrectly. Try downloading the file again or contact the application provider.
The MIDP Specification 1.0 requires a JAD file to have certain properties in a certain format. The PRC Converter Tool will not convert a JAD file that does not follow this requirement of the specification.


This makes me think that there may be some issue with the manifest file in the .JAR since that's the only bit I know of that has to have specific information in a specific order.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I posted all the text files above as well as the commands I used to create the JAR file. If you have some time, I would definitely appreciate you taking a look to see if there is something you think I should change.
Thanks,
Layne
 
Author
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I spotted a typo in your manifest.txt:
WelcomBack should be WelcomeBack
But I doubt that would cause the PRC conversion to barf. Different tools have different sensitivities to JAD and manifest files, including real devices that sometimes won't install MIDlet suites for the smallest infractions in the JAD. I'm sorry I can't provide a better answer, but you may just have to futz with the JAD and manifest until it works. You might want to check through the MIDP specification and make sure you're following the letter of the law with respect to the attributes in the JAD and the manifest.
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you're on to something there - I remember reading something about how there's data in the JAD file that's identical to some of the data in the manifest. I wouldn't be surprised if fixing the typo solved the issue - or at least *this* issue.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jonathan Knudsen:
I spotted a typo in your manifest.txt:
WelcomBack should be WelcomeBack


Thank you for taking the time to find such a small error! I'll fix it as soon as I get home from campus this evening. Sometimes one character CAN make the difference. At the very least, it is worth a try.
Layne
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let us know how it goes. Good luck!
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apparently, some recent changes to my system have set me back a bit. I reinstalled Red Hat Linux 8 this last week and am still reconfiguring all my development tools. In particular, I get the following error when I try to compile and preverify any midlet:

I don't remember ever having this problem with preverify before. Any ideas about what I need to do to fix it?
Layne
 
Michael Yuan
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using JDK 1.4's javac to compile, set the output target tag to "1.1". (javac -target 1.1 ...) It is a known problem with J2MEWTK v1.0.
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Micheal,
Thanks for the info - that's a problem I would've run into for sure.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hmm...I'm not even using the Wireless Toolkit. I develop under Linux and use a makefile to organize all the commands needed to create a midlet. If you are familiar with make, I run the following command to get the output that I posted above:
make AccessingCommands.java
If you aren't familiar with make, suffice it to say that all the commands above were run from the command line.
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Layne,
I'd recommend looking into using the toolkit - from what I understand it make a lot of this stuff (packaging, etc) much easier.
At least take a look at ant - I remember using make, and while its pretty powerful, I think you'll like ant better. Many Java-ites do.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the suggestions. I've started using ANT for some other Java projects, and I'll look into writing my own build scripts for J2ME projects as well. I've also tried using WTK, but haven't had any success with it. It's been a while since I tried it out, so I don't remember any of the problems off the top of my head. I'll try it out again and start another thread with some questions.
Still, I'd like to know how to fix the current problem with preverifying the class file. I haven't used the target setting yet. I didn't have much time to work on this yesterday, so I'll try it when I go home later today. If anyone has any other suggestions, I'd really appreciate it.
Layne
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Layne, you should definitely take a look at Ant -- especially with Antenna.
- Ant home page
- Antenna home page
Setting up Ant+Antenna is a breeze, and oops, you're not dependent on any particular J2ME-enabled IDE anymore
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I already have ant installed. I'll check out antenna as well. Is antenna an IDE or what?
So do you have any ideas about fixing the error I get from preverify?
 
Jonathan Knudsen
Author
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Layne-- did you try "-target 1.1" as Michael suggested? I think that should fix the problem you're seeing with preverify.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't had a chance to try that yet. I'm on campus now and won't get home until later this evening. I should have clarified that I'm still open to additional ideas if anyone has a suggestion. I'll try Michael's suggestion as soon as I get home tonight.
Layne
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dang! I was hoping to know how this turned out before I leave for the weekend. Ah well, something to look forward to on Monday I guess.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Layne Lund:
Is antenna an IDE or what?


Antenna is a set of Ant tasks for automating the J2ME build and deployment process (compilation, preverification, obfuscation, packaging). You're not making your .ear files by hand either, are you?

Originally posted by Layne Lund:
So do you have any ideas about fixing the error I get from preverify?


Unfortunately no. I remember having some error messages from Antenna's preverify task when setting up a project but I can't remember the exact error and I managed to get past it in a couple of minutes so the solution didn't stick to my mind either.
I hope the -target option helps!
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You're not making your .ear files by hand either, are you?


I'm not sure whether the joke is that .ear files don't even exist or that they are some binary file that would be a pain in the ass to create by hand. If .ear files are real, what are they? I've never heard of them.

If you are using JDK 1.4's javac to compile, set the output target tag to "1.1". (javac -target 1.1 ...) It is a known problem with J2MEWTK v1.0.


Hey, it worked! I can run my midlets with the Sun implementation now. Perhaps this is an issue with MIDP 1.0 in general and not just J2MEWTK. I arrived at this conclusion because I was previously developing with MIDP 2.0. I am always interested in the most recent version of any kind of programming tool. This was before I found out that Palm only supports MIDP 1.0. So when I was reconfiguring my system (for issues unrelated to J2ME), I decided to switch to MIDP 1.0 since Palm is currently the only device I own which will run any midlets I develop. The emulator is good for testing and all, but it's much more exciting to run a midlet on an actual device. Anyway, the error occured just after I set up the PATH and CLASSPATH environment variables to use my MIDP 1.0 installation, instead of MIDP 2.0.
Now I can move onward to converting a midlet to a PRC file. Hopefully now that I'm using MIDP 1.0, it won't give me the previous errors. I'm not holding my breath, however. I'll be back with the results tomorrow.
Layne
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Layne, I sometimes forget that all folks are not my identical twins
I've been working with J2EE for so long that I take certain things for granted. An .ear file is basically a .jar archive with a different suffix and contains a J2EE application.
Oh, I'm glad that you got your stuff working!
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I DO create all my .jar files by hand. I haven't done any J2EE yet, though. I want to look into it eventually. There are just so many things to learn and not enough time to learn it all.
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Layne,
Just to be clear, was made it work? Telling the JDK to create a 1.1 compatible output, or what?
Thanks,
Burk
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about that. I thought I put that part in my post. Yes, when I used "-target 1.1" to compile the class file, preverify ran without a hitch.
Now, I'm encountering troubles with midp4palm. First I'm going to download it again, just in case any of the files were somehow corrupted. I'll be back tomorrow with error messages, if I get any.
Layne
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, I'm finally back where I started with this thread. I am getting the same error as in my first post when I try to convert a midlet suite to a prc file. I found another typo in the .jad file, but it still doesn't work.
I guess I should post my updated code, especially the manifest and .jad files. I didn't bring them with me to campus today, and school is closed tomorrow and the rest of the weekend. I'll post it on Monday, then. In the meantime, if anyone has any brilliant ideas, I'm all ears.
Layne
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic