jad ( Java Application Discriptor ) 文件是J2ME的一个重要的组成部分,在我们发布J2ME程序的时候,jad文件经常报出各种错误,如:
com.sun.kvem.midletsuite.InvalidJadException: Reason = 13
其中的错误原因是1-52的代码,很让人费解。我在网上找到了这些代码的解释,和大家分享如下:
public static final int JAD_SERVER_NOT_FOUND = 1;public static final int JAD_NOT_FOUND = 2;public static final int MISSING_PROVIDER_CERT = 4;public static final int CORRUPT_PROVIDER_CERT = 5;public static final int UNKNOWN_CA = 6;public static final int INVALID_PROVIDER_CERT = 7;public static final int CORRUPT_SIGNATURE = 8;public static final int INVALID_SIGNATURE = 9;public static final int UNSUPPORTED_CERT = 10;public static final int EXPIRED_PROVIDER_CERT = 11;public static final int EXPIRED_CA_KEY = 12;public static final int MISSING_SUITE_NAME = 13;public static final int MISSING_VENDOR = 14;public static final int MISSING_VERSION = 15;public static final int INVALID_VERSION = 16;public static final int OLD_VERSION = 17;public static final int MISSING_JAR_URL = 18;public static final int JAR_SERVER_NOT_FOUND = 19;public static final int JAR_NOT_FOUND = 20;public static final int MISSING_JAR_SIZE = 21;public static final int SUITE_NAME_MISMATCH = 25;public static final int VERSION_MISMATCH = 26;public static final int VENDOR_MISMATCH = 27;public static final int INVALID_KEY = 28;public static final int INVALID_VALUE = 29;public static final int INSUFFICIENT_STORAGE = 30;public static final int JAR_SIZE_MISMATCH = 31;public static final int NEW_VERSION = 32;public static final int UNAUTHORIZED = 33;public static final int JAD_MOVED = 34;public static final int CANNOT_AUTH = 35;public static final int CORRUPT_JAR = 36;public static final int INVALID_JAD_TYPE = 37;public static final int INVALID_JAR_TYPE = 38;public static final int ALREADY_INSTALLED = 39;public static final int DEVICE_INCOMPATIBLE = 40;public static final int MISSING_CONFIGURATION = 41;public static final int MISSING_PROFILE = 42;public static final int INVALID_JAD_URL = 43;public static final int INVALID_JAR_URL = 44;public static final int PUSH_DUP_FAILURE = 45;public static final int PUSH_FORMAT_FAILURE = 46;public static final int PUSH_PROTO_FAILURE = 47;public static final int PUSH_CLASS_FAILURE = 48;public static final int AUTHORIZATION_FAILURE = 49;public static final int ATTRIBUTE_MISMATCH = 50;public static final int PROXY_AUTH = 51;public static final int TRUSTED_OVERWRITE_FAILURE = 52;
有了这些代码的解释,我们就很容易知道错误的原因了。
另外,大家知道,有的手机在安装jar文件的时候,不需要jad文件。这是因为手机厂商在操作系统中内置了对jar文件的解析功能。就如同手机自动生成jad文件,然后使用这个jad文件安装jar文件一样。