This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java Micro Edition and the fly likes preverification of classes extracted from jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "preverification of classes extracted from jar" Watch "preverification of classes extracted from jar" New topic
Author

preverification of classes extracted from jar

Jeremy Thornton
Ranch Hand

Joined: Feb 21, 2002
Posts: 91
Howdy,
Does anyone know if classes that are extracted from a jar file need to be preverified again ?
I'm trying to write a library and, as you can't include a jar file with MIDP classes, I guess that the easiest way to link the library code with existing code is to extract classes from a jar file, add the extracted folder to the classpath to compile and munge the whole lot together in a jar so that it can be loaded onto the phone.
Only problem with this is that the library classes cause a verification error to occur on the phone.
If I do exactly the same thing but skipping the initial jaring the Library step (e.g. just copy the classes across to the project using the "library") then all is ok.
In summary, does anyone know how to create a jar file containing classes that can be extracted and used without re-preverifying them ?
Cheers,
Jeremy
a sanjuan
Ranch Hand

Joined: Jun 12, 2002
Posts: 164
maybe i misunderstood, but all classes need to be preverified before execution because the verifier in the device will be looking for stack map attributes in the preverified classes. so why not first preverify the classes that you can then insert into the jar? you can then remove them later. preverified classes will work fine with the J2SE VM.
Jeremy Thornton
Ranch Hand

Joined: Feb 21, 2002
Posts: 91
My initial testing showed the following (I think).
1) Preverified classes can be copied across to a new project, added to the classpath and then jared up as normal. As expected this works ok.
2) if the preverified classes are jared and then unjared in the new project and the above step carried out then the phone complains that they are bogus.
Seems like it's the jaring stage that distorts preverified classes.
has anyone else tried this at all ?
Liam Quinn
Ranch Hand

Joined: Jan 18, 2002
Posts: 35
With my MIDP class libraries, I don't preverify them, and I distribute a JAR. The developer using the library will preverify the classes when building his or her MIDlet.
Jeremy Thornton
Ranch Hand

Joined: Feb 21, 2002
Posts: 91
Thanks Liam,
Just wanted to make sure I wasn't missing anything obvious.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: preverification of classes extracted from jar