标签:
Exception in thread "EventThread" java.lang.NullPointerException
at org.jdesktop.jdic.browser.internal.MsgClient.<init>(Unknown Source)
at org.jdesktop.jdic.browser.internal.NativeEventThread.run(Unknown Source)
该错误原因为pc默认浏览器不是Ie引起的,在声明里设置默认浏览器即可解决。
public class BrowserTest { static { BrowserEngineManager engineManager = BrowserEngineManager.instance(); engineManager.setActiveEngine(BrowserEngineManager.IE); } public static void main(String[] args) throws Exception { WebBrowser browser = new WebBrowser(); browser.setURL(new URL("http://www.baidu.com")); JFrame frame = new JFrame("Browser Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(browser); frame.pack(); frame.setSize(500, 500); frame.setVisible(true); } }
JDIC 访问Web时NullPointerException
标签:
原文地址:http://www.cnblogs.com/chaizp/p/4603685.html