java应用程序中嵌入浏览器总结

来源:互联网 发布:万方数据库医学网 编辑:程序博客网 时间:2024/05/01 18:12

java应用程序中嵌套浏览器总结,总结了一下。

1.org.eclipse.swt.SWTError: No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]  SWTError:没有更多的处理[未知Mozilla的路径(MOZILLA_FIVE_HOME未设置)]

环境:linux下运行swt程序(我出现此问题是,在linux下嵌套浏览器)
原因:firefox版本不一致
解决:重装一个firefox,并设置相关变量(如:firefox-3.0.14-1.el5.centos)


2.Exception in thread "main" org.eclipse.swt.SWTError: 
  No more handles [Could not detect registered XULRunner to use]
环境:用XULRunner 在java application中嵌套浏览器
原因:没有注册XULRunner
解决:window下环境中,在程序中加入,如(第二个参数是下载解压后的存放路径):
   static{     System.setProperty("org.eclipse.swt.browser.XULRunnerPath", "C:\\xulrunner");    }


3.Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3536 or swt-win32 in swt.library.path, java.library.path or the jar file
环境:用DJ Natvie Swing时,在java application中嵌套浏览器,且在windows环境下运行正常,
   但在linux下却包此异常
原因:windows下与linux下使用的swt jar包不一样
解决:在windows下用swt-3.5M6-win32-win32-x86.jar,在linux下用swt-3.5.1-gtk-linux-x86.jar


4.Exception in thread "main" java.net.ProtocolException:cannot write to a URLConnection if doOutput=false - call setDoOutput(true)

环境: 用URLConnection送某url发送数据时
原因: doOutput=false时,不能发送数据
解决: 如 urlConnection.setDoOutput(true)

5.错误提示信息我忘了,大概的意思就是,在linux下通过firefox来访问带有flash的页面正常,但是通过DJ-native Swing 嵌套来访问就会报没有flash插件

环境: 在linux下运行用DJ-native-swing嵌套的浏览器访问带有flash的网页
原因: XULRUnner自带的firefox不是完全版
解决: 将XULRunner下的flash插件链接到系统安装的firefox下

如:ln -s /usr/lib/xulrunner-1.9/plugins/libflashplayer.so /usr/lib/firefox-3.0.14/plugins/