我当前正在尝试使用netbeans 6.9.1开发应用程序,但在尝试运行该程序时遇到以下错误
Uncaught exception: java.lang.IllegalArgumentException
at javax.microedition.io.Connector.openPrim(), bci=31
at javax.microedition.io.Connector.open(), bci=3
at javax.microedition.io.Connector.open(), bci=3
at javax.microedition.io.Connector.open(), bci=2
at RSSParser$1.run(RSSParser.java:32)此错误来自以下代码
public void parse(final String url) {
Thread t = new Thread() {
public void run() {
// set up the network connection
HttpConnection hc = null;
try {
hc = (HttpConnection)Connector.open(url);
parse(hc.openInputStream());
}
catch (IOException ioe) {
mRSSListener.exception(ioe);
}
finally {
try { if (hc != null) hc.close(); }
catch (IOException ignored) {}
}
}
};
t.start();
}此方法正从此处的另一个类调用
public void startApp() {
if (mDisplay == null)
mDisplay = Display.getDisplay(this);
if (mInitialized == false) {
// Put up the waiting screen.
Screen waitScreen = new Form("Connecting...");
mDisplay.setCurrent(waitScreen);
// Create the title list.
mTitleList = new List("Headlines", List.IMPLICIT);
mExitCommand = new Command("Exit", Command.EXIT, 0);
mDetailsCommand = new Command("Details", Command.SCREEN, 0);
mTitleList.addCommand(mExitCommand);
mTitleList.addCommand(mDetailsCommand);
mTitleList.setCommandListener(this);
// Start parsing.
String url = getAppProperty("RSSMIDlet.URL");
RSSParser parser = new RSSParser();
parser.setRSSListener(this);
parser.parse(url);
mInitialized = true;
}
else
mDisplay.setCurrent(mTitleList);
}当我调试它时,它告诉我"String url“是空的,我该如何解决这个问题呢?
String url = getAppProperty("RSSMIDlet.http://wwww.anything.com");
String url = getAppProperty("http://wwww.anything.com");但这应该无关紧要,因为第一种方式有一个默认的url。
有人知道我做错了什么吗?
发布于 2012-01-17 21:21:46
这有帮助吗?
String url = "http://wwww.anything.com";如果您参考文章Parsing XML in J2ME,您应该知道它是从2002年开始的,从那时起,kxml已经得到了改进。
如果您处于运行midlet的不幸境地,那么您可能会对此documentation感兴趣。您需要通过在清单文件中将属性名称RSSMIDlet.URL设置为http://wwww.anything.com来配置midlet。
https://stackoverflow.com/questions/8894685
复制相似问题