Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Preverify on Windows and Linux differ? PROBLEM

 
MC Otten
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm using Knoppix 3.3 (Linux), J2ME Wireless TK 2.0.01 for Linux and J2sdk1.4.0_02 for linux. I compile my code like this:
javac -target 1.2 -classpath /usr/local/bin/WTK2.0/lib/midpapi.zip -d /<path>/out/tmpclasses /<path>/out/*.java
The classes appear in tmpclasses. Now I preverify everything:
/usr/local/bin/WTK2.0/bin/preverify -classpath /usr/local/bin/WTK2.0/lib/midpapi.zip -d /<path>/out/classes -cldc /<out>/out/tmpclasses/
The preverified classes appear in classes.
Now this is done, I create a jar file:
/usr/local/bin/j2sdk1.4.2_02/bin/jar cfm /<path>/out/DictionaryApp.jar /<path>/out/MANIFEST.MF -C /<path>/out/classes . -C /<path>/out/res . '
I generate a jad file and my MIDlet suite has born. I copy this suite to my Windows 2000 machine and run the suite with the Nokia emulator. No problem. NOW I try the same with the Sony Ericcson emulator and have the following error:
Error verifying method DictionaryApp$1 <init>(LDictionaryApp;Ljavax/microedition/lcdui/Displayable;Ljavax/microedition/lcdui/Command V
Approximate bytecode offset 2: Bad type on stack
ALERT: Error verifying class DictionaryApp$1
The MIDlet won't work on a Nokia 3650 or Samsung S300 either. But when I use the class files generated by the KToolbar of Nokia, I CAN run the MIDlet on the Ericcson emulator as well as on the Nokia and Samsung. So there must be a difference between the preverify method of the Linux WTK and the Windows WTK. What can I do to solve this?
Greetings,
Matthijs.
[ December 03, 2003: Message edited by: MC Otten ]
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A couple of things to think about:
1. Does your Linux preverified JAR file work on WTK emulators? (both windows and linux?)
2. Which Nokia emulator on windows did you use? did you use a production emulator or a "concept" emulator?
3. What do you mean by "KToolbar of Nokia"? Did you use the preverify program in Nokia NDS to process your class files on Windows?
4. Finally, you can always compare the Linux and Windows preverified class files directly to see the difference.
But if I were you, I would not bother. It is probably a bug in the preverify program or in the emulator. You have already found a way to work around.
 
MC Otten
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Yuan:
A couple of things to think about:
1. Does your Linux preverified JAR file work on WTK emulators? (both windows and linux?)
2. Which Nokia emulator on windows did you use? did you use a production emulator or a "concept" emulator?
3. What do you mean by "KToolbar of Nokia"? Did you use the preverify program in Nokia NDS to process your class files on Windows?
4. Finally, you can always compare the Linux and Windows preverified class files directly to see the difference.
But if I were you, I would not bother. It is probably a bug in the preverify program or in the emulator. You have already found a way to work around.

Hmm seems to me that I didn't use the right javac file on linux. I've entered the entire path to the javac executable and replaced 'classpath' by 'bootclasspath'. It's working now! Thanx anyway for your response.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic