This article aims to explain the properties in question MIDP, mainly related to the jad and MANIFEST.MF files of some of the concepts. In fact many people did not know the details in this regard. So you should carefully read this article.
MIDP applications are usually based. Jar files and. Jad files released. jar file is what we call the jar package, jad file's full name is the java application descriptor. In the jad file contains the Application Management Software to manage MIDlets in the life cycle of information, of course, include many important properties. They are in pairs for example: MIDlet-Name: myjava. You can call getAppProperty ("MIDlet-Name") to get the String type of myjava, which is very handy if you want your MIDlet to the network then you can define a name for the SERVER_URL, define the value of it http://yourip:port/myservlet, so if you want to connect to other addresses, then only need to modify the jad file, and do not need to recompile. Therefore, we must be aware that some of the jad file MIDlet initialization which needs to place value is more desirable.
In the jar package which includes a directory META-INFO files inside a MANIFEST.MF. It is used to describe the JAR file also contains some other information, you may find, in the MANIFEST.MF and the JAD file, some of the values are the same. Then there is a rule which, AMS how to determine which value to read it? The answer is this.
If the MIDlets in the jar package is signed, then the AMS to go look at its digital signature, if it is effective then it will begin to read the contents of MANIFEST.MF, and then read the jad file the same content, so if the match would It will install the jar package, if you do not match, then it will refuse to install. If he found that the digital signature is invalid, then it will refuse to install directly.
If MDIlets the jar package is unsigned, then put it considers non-trust AMS, and he went to read the jad file attributes, if found not to read the MANIFEST, then it's content, which means that if both jad and MANIFEST AMS only to read the attributes in jad.
Following this logic appears to be more clear:
given: String key / / attribute name
return: String value
throws: NullPointerException if key is null
if trusted
String v0 = lookup key in manifest
String v1 = lookup key in descriptor
if (v0! = null & & v1! = null)
/ / Found in both; must be the same value
assert (v0.compareTo (v1) == 0);
value = (v1! = null)? v1: v0;
else / / untrusted
value = lookup key in descriptor
if value == null
value = lookup key in manifest
return value
The following outlines some important MIDP2.0 defined the parameters defined in MIDP2.0 18 value. Which in the MANIFEST.MF and the jad in the six must be defined, they are:
MIDlet-Name
MIDlet-Version
MIDlet-Vendor
MicroEdition-Profile
MicroEdition-Configuration
MIDlet-n
As the inside of a MIDlet suite can have multiple MIDlet, so you have to explain them such as MIDlet-1, MIDlet-2 ..... MIDlet-n, it is very important, in the deployment jar and jad files to the phone when must ensure that the correct MIDlet-Name, its value is the name of your jar package! Otherwise does not install successfully. There are two values is the jad file, they allowed some MIDlet-Jar-URL,
MIDlet-Jar-Size One should note that the MIDlet-Jar-URL, if you wanted to download via OTA, then you must not let him point to the absolute address of your jar package, such as http://myip:port/app/myapp. jar.
On more than one MIDlet suite MIDlet inside the case I wrote a simple code to test it, so if you have questions about what you can run the following procedure:
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class MIDlet1 extends MIDlet
(
private Display display;
protected void startApp () throws MIDletStateChangeException
(
display = Display.getDisplay (this);
display.setCurrent (new Form ("1"));
)
protected void pauseApp ()
(
)
protected void destroyApp (boolean arg0) throws MIDletStateChangeException
(
)
)
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class MIDlet2 extends MIDlet
(
private Display display;
protected void startApp () throws MIDletStateChangeException
(
display = Display.getDisplay (this);
display.setCurrent (new Form ("2"));
)
protected void pauseApp ()
(
)
protected void destroyApp (boolean arg0) throws MIDletStateChangeException
(
)
)
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class MIDlet3 extends MIDlet
(
private Display display;
protected void startApp () throws MIDletStateChangeException
(
display = Display.getDisplay (this);
display.setCurrent (new Form ("3"));
)
protected void pauseApp ()
(
)
protected void destroyApp (boolean arg0) throws MIDletStateChangeException
(
)
)
JAD file as follows:
MIDlet-3: MIDlet3,, MIDlet3
MIDlet-2: MIDlet1,, MIDlet1
MIDlet-1: MIDlet2,, MIDlet2
MIDlet-Jar-URL: MIDlets.jar
MicroEdition-Configuration: CLDC-1.0
MIDlet-Version: 1.0.0
MIDlet-Name: MIDlets
MIDlet-Vendor: Midlet Suite Vendor
MicroEdition-Profile MIDP-1.0
The above three. Java files are packaged into MIDlets.jar file, then double-click. Jad file. Program can be run up, I wtk2.1 run without any problems!
Recommended links:
Brothers do not fly when the patent stick and bully foreigners
Li Yi: Collective genuine lack of awareness?
YouTube to FLV
MKV To MOV
Understanding Of EIP
Reviews Firewall And Proxy Servers
pa chips Toward the end of all itanium based hp
2 strokes are not easy to input text font
"Aion" 1.2 There are a brush obs of the bug is still alive
Bitter start, The result of joy
Brief Audio CD Players
Routing Protocol RIP Routing Basics Introduction To Note (1)
VOB to WMV
COMMENTS File And Disk Management
Hard to BREAK lose money Shucu low self Breakthrough Zhongguancun Marketplace
British grams, Novel Medicine 1000 Chain layout help
No comments:
Post a Comment