-1
嗨嗨朋友我創建了一個j2me應用。它完美地運行在模擬器,但在移動它顯示像java.lang.nosuchfielderror:No such field HEADERS.[[Ljava/lang/String;.
爲什麼發生這種情況與移動,它運行在模擬器良好的錯誤...... 請幫我刪除這個錯誤......j2me中的java.lang.nosuchfielderror應用
public String connectPhoneName() throws Exception{
String url = "http://122.170.122.186/Magic/getPhonetype.jsp";
String phoneType;
if ((conn = connectHttp.connect(url, HEADERS)) != null) {
if ((in = connectHttp.getDataInputStream(conn)) != null) {
byte[] data = connectHttp.readDATA(in, 100);
phoneType = new String(data);
System.out.println("DATA : " + phoneType);
} else {
throw new Exception("ERROR WHILE OPENING INPUTSTREAM");
}
} else {
throw new Exception("COULD NOT ESTABLISH CONNECTION TO THE SERVER");
}
return phoneType;
}
在這段代碼中我使用了HEADERS。
請檢查驗證碼 – 2011-03-24 12:15:45
嗨你好這個字段HEADERS在接口MagiDEF中聲明,它被聲明爲'public String HEADERS [] [] = {{「User-Agent」,Profile/MIDP-1.0 Configuration/CLDC- 1.0" }};」 &這用於像url.setRequestProperty(HEADERS [0] [0],HEADERS [0] [1])的url的setRequestProperty; – 2011-03-25 07:31:39