smartdanny
   
發文: 598
積分: 1
|
於 2013-06-02 20:50
     
各位大大小弟想使用DJ Native Swing 套件的JWebBrowser功能來做瀏覽網頁的功能, 但是小弟遇到了幾個問題 我呼叫JWebBrowser的code如下
1 2 3 4 5 6 7 8 9 10 11 12
| NativeInterface.open();
final JWebBrowser webBrowser = new JWebBrowser(JWebBrowser.destroyOnFinalization(), JWebBrowser.proxyComponentHierarchy());
webBrowser.setMenuBarVisible(false);
webBrowser.setButtonBarVisible(false);
webBrowser.setLocationBarVisible(false);
webBrowser.navigate("www.google.com.tw");
JFrame frame = new JFrame();
frame.setSize(800, 600);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.getContentPane().add(webBrowser);
frame.setVisible(true);*/
|
1.當我把程式寫好包成Applet的jar檔在jre1.7.0_21上run之後,在java console上出現下面的錯誤
1 2
| Under WebStart on Java >= 1.6.0_18, the value of the "sun.awt.disableMixing" system property needs to be defined in the JNLP descriptor with value "true" (or "false" if you really want the default behavior). When not set to "true", the content of the native components may not be displayed.
NativeSwing[1]: Exception in thread "Thread-0" java.lang.NoClassDefFoundError: chrriis/dj/nativeswing/swtimpl/core/SWTNativeInterface$4
|
2.我就造錯誤上的方式使用JNLP把sun.awt.disableMixing設為true,也一並使用JNLP來呼叫我的Applet程式,JNLP內容如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| <?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for DJNativeSwing -->
<jnlp spec="1.0+"
codebase="http://192.168.17.124"
href="DJN.jnlp">
<information>
<title>Danny JNLP TEST</title>
<vendor>Big Danny</vendor>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<property name="jnlp.packEnabled" value="true" />
<property name="sun.awt.disableMixing" value="true" />
<!-- Application Resources -->
<j2se version="1.6+"
href="http://java.sun.com/products/autodl/j2se" />
<jar href="AppletCNM.jar" main="true" />
</resources>
<applet-desc
name="L7 Applet"
main-class="cnm.AppletCNM"
width="300"
height="300">
</applet-desc>
<update check="background"/>
</jnlp>
|
inex.html內容如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Big5">
<title>
Management Console
</title>
</head>
<body background="image/company/index_01.jpg" style="background-repeat:no-repeat">
<applet jnlp_href="DJN.jnlp"
width="0"
height="0">
</applet>
</body>
</html>
|
但是程式又發生NoClassDefFoundError的Exception如下
1 2 3 4 5 6 7 8 9
| NativeSwing[1]: Exception in thread "Thread-0" java.lang.NoClassDefFoundError: chrriis/dj/nativeswing/swtimpl/core/SWTNativeInterface$4
NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.destroyControls(SWTNativeInterface.java:1320)
NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.access$4(SWTNativeInterface.java:1317)
NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess$4.run(SWTNativeInterface.java:1171)
NativeSwing[1]: Caused by: java.lang.ClassNotFoundException: chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$4
NativeSwing[1]: at chrriis.common.NetworkURLClassLoader.findClass(NetworkURLClassLoader.java:77)
NativeSwing[1]: at java.lang.ClassLoader.loadClass(Unknown Source)
NativeSwing[1]: at java.lang.ClassLoader.loadClass(Unknown Source)
NativeSwing[1]: ... 3 more
|
我已經將DJ Native Swing套件都包在我的Applet jar檔裡面了,為什麼還找不到該class,我該怎麼做,請各位高手幫幫忙
smartdanny edited on 2013-06-02 20:52
 
我是API 白癡!! 重新學習GOGO!!
|