Hello chrriis , thanks for amazing components.
My english is not so good , but you will understand what i write to this post.
My environment is Netbeans 7.0 M2 .I have imported all jar files from your
project to libraries folder of my project that i have named DemoFrame.
My OS is ubuntu and when i run this , i get exception
NativeSwing[1]: Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
NativeSwing[1]: no swt-win32-3650 in java.library.path
NativeSwing[1]: no swt-win32 in java.library.path
NativeSwing[1]: Can't load library: /tmp/swtlib-32/libswt-win32-3650.so
NativeSwing[1]: Can't load library: /tmp/swtlib-32/libswt-win32.so
NativeSwing[1]:
NativeSwing[1]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[1]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[1]: at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
NativeSwing[1]: at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
NativeSwing[1]: at java.lang.Class.forName0(Native Method)
NativeSwing[1]: at java.lang.Class.forName(Class.java:169)
NativeSwing[1]: at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.runNativeSide(SWTNativeInterface.java:1201)
NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.main_(SWTNativeInterface.java:1385)
NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:220)
NativeSwing[2]: Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
NativeSwing[2]: no swt-win32-3650 in java.library.path
NativeSwing[2]: no swt-win32 in java.library.path
NativeSwing[2]: Can't load library: /tmp/swtlib-32/libswt-win32-3650.so
NativeSwing[2]: Can't load library: /tmp/swtlib-32/libswt-win32.so
NativeSwing[2]:
NativeSwing[2]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[2]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[2]: at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
NativeSwing[2]: at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
NativeSwing[2]: at java.lang.Class.forName0(Native Method)
NativeSwing[2]: at java.lang.Class.forName(Class.java:169)
NativeSwing[2]: at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
NativeSwing[2]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.runNativeSide(SWTNativeInterface.java:1201)
NativeSwing[2]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.main_(SWTNativeInterface.java:1385)
NativeSwing[2]: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:220)
NativeSwing[3]: Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
NativeSwing[3]: no swt-win32-3650 in java.library.path
NativeSwing[3]: no swt-win32 in java.library.path
NativeSwing[3]: Can't load library: /tmp/swtlib-32/libswt-win32-3650.so
NativeSwing[3]: Can't load library: /tmp/swtlib-32/libswt-win32.so
NativeSwing[3]:
NativeSwing[3]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[3]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[3]: at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
NativeSwing[3]: at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
NativeSwing[3]: at java.lang.Class.forName0(Native Method)
NativeSwing[3]: at java.lang.Class.forName(Class.java:169)
NativeSwing[3]: at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
NativeSwing[3]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.runNativeSide(SWTNativeInterface.java:1201)
NativeSwing[3]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.main_(SWTNativeInterface.java:1385)
NativeSwing[3]: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:220)
Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Connection reset
at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface.openChannel(OutProcessSocketsMessagingInterface.java:67)
at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface.initialize(MessagingInterface.java:57)
at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface.<init>(OutProcessSocketsMessagingInterface.java:32)
at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface$SwingOutProcessSocketsMessagingInterface.<init>(OutProcessSocketsMessagingInterface.java:162)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.createOutProcessMessagingInterface(SWTNativeInterface.java:1030)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.createOutProcessCommunicationChannel(SWTNativeInterface.java:732)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.open_(SWTNativeInterface.java:317)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:100)
at chrriis.dj.nativeswing.swtimpl.demo.DemoFrame.main(DemoFrame.java:48)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2266)
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2279)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface.openChannel(OutProcessSocketsMessagingInterface.java:65)
... 8 more
Java Result: 1
I know that something is going on with my configuration but to me it's not
clear .Below is the code from DemoFrame .
packagechrriis.dj.nativeswing.swtimpl.demo;importjava.awt.BorderLayout;importjava.awt.Dimension;importjava.util.Arrays;importjavax.swing.BorderFactory;importjavax.swing.JFrame;importjavax.swing.JPanel;importjavax.swing.JScrollPane;importjavax.swing.JTextArea;importjavax.swing.SwingUtilities;importchrriis.common.UIUtils;importchrriis.dj.nativeswing.swtimpl.NativeInterface;importchrriis.dj.nativeswing.swtimpl.components.JWebBrowser;importchrriis.dj.nativeswing.swtimpl.components.WebBrowserFunction;/***@authorChristopherDeckers*/publicclassDemoFrameextendsJPanel{privatestaticfinalStringLS=System.getProperty("line.separator");publicDemoFrame(){super(newBorderLayout());JPanelwebBrowserPanel=newJPanel(newBorderLayout());webBrowserPanel.setBorder(BorderFactory.createTitledBorder("Native Web Browser component"));JWebBrowserwebBrowser=newJWebBrowser();webBrowser.setBarsVisible(false);finalJTextAreafunctionCallsTextArea=newJTextArea(7,0);webBrowser.registerFunction(newWebBrowserFunction("invokeJava"){@OverridepublicObjectinvoke(JWebBrowserwebBrowser,Object...args){StringBuildersb=newStringBuilder();sb.append("-> "+getName()+"() called from Javascript with args:");for(inti=0;i<args.length;i++){Objectarg=args[i];if(arg==null){sb.append(LS).append(" null");}else{sb.append(LS).append(" ").append(arginstanceofObject[]?Arrays.deepToString((Object[])arg):arg.toString()).append(" (").append(arg.getClass().getSimpleName()).append(")");}}sb.append(LS).append("-> return Object[] result:").append(LS).append(" (short)3").append(LS).append(" true").append(LS).append(" null").append(LS).append(" new Object[] {\"A String\", false}").append(LS).append(" \"Hello World!\"").append(LS).append(" 2.0f / 3.0f");functionCallsTextArea.setText(sb.toString());functionCallsTextArea.setCaretPosition(0);returnnewObject[]{(short)3,true,null,newObject[]{"A String",false},"Hello World!",2.0f/3.0f};}});webBrowser.registerFunction(newWebBrowserFunction("invokeJavaWithError"){@OverridepublicObjectinvoke(JWebBrowserwebBrowser,Object...args){functionCallsTextArea.setText("-> "+getName()+"() called from Javascript."+LS+"-> Generating a Java runtime exception.");functionCallsTextArea.setCaretPosition(0);//Thiswillgenerateanerrorreturn10/0;}});webBrowser.setHTMLContent("<html>"+LS+" <head>"+LS+" <script language=\"JavaScript\">"+LS+" function callJava() {"+LS+" var result = invokeJava(123, false, null, [1.2, ['hi', true]], 'swing');"+LS+" var s = 'Result from invokeJava():';"+LS+" for (var i = 0; i < result.length; i++) {"+LS+" s += '\\n ' + result[i];"+LS+" }"+LS+" alert(s);"+LS+" }"+LS+" function callJavaWithError() {"+LS+" var s = 'Result from invokeJavaWithError():\\n ';"+LS+" try {"+LS+" invokeJavaWithError();"+LS+" s += 'success';"+LS+" } catch (e) {"+LS+" s += 'Java error (' + e.message + ')';"+LS+" }"+LS+" alert(s);"+LS+" }"+LS+" </script>"+LS+" </head>"+LS+" <body>"+LS+" <p>"+LS+" Object[] invokeJava(123, false, null, [1.2, ['hi', true]], 'swing'):<br/><input id=button type=\"button\" value=\"call\" onclick=\"callJava();\">"+LS+" </p><p>"+LS+" Object invokeJavaWithError():<br/><input id=button type=\"button\" value=\"call\" onclick=\"callJavaWithError();\">"+LS+" </p>"+LS+" </body>"+LS+"</html>");webBrowserPanel.add(webBrowser,BorderLayout.CENTER);webBrowserPanel.setPreferredSize(newDimension(100,200));add(webBrowserPanel,BorderLayout.NORTH);//Createanadditionalareatoshowthefunctioncalls.JPanelfunctionalCallsPanel=newJPanel(newBorderLayout());functionalCallsPanel.setBorder(BorderFactory.createTitledBorder("Java log for Javascript custom function calls"));functionCallsTextArea.setEditable(false);functionalCallsPanel.add(newJScrollPane(functionCallsTextArea));add(functionalCallsPanel,BorderLayout.CENTER);}/*Standardmainmethodtotrythattestasastandaloneapplication.*/publicstaticvoidmain(String[]args){UIUtils.setPreferredLookAndFeel();//NativeInterface.open();SwingUtilities.invokeLater(newRunnable(){publicvoidrun(){JFrameframe=newJFrame("DJ Native Swing Test");frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.getContentPane().add(newDemoFrame(),BorderLayout.CENTER);frame.setSize(800,600);frame.setLocationByPlatform(true);frame.setVisible(true);}});//NativeInterface.runEventPump();}}
What is wrong here with the code ?
Thank you very much for your project
Best regards George Tselios .
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello chriis again .Thanks for the fast replay .Yes it's all ok now except one
thing more .I get this exception now
java.lang.IllegalStateException: The SyntaxHighlighter distribution is missing from the classpath!
at chrriis.dj.nativeswing.swtimpl.components.JSyntaxHighlighter.<init>(JSyntaxHighlighter.java:37)
If you can send me an answear .
Best regards
George Tselios .
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please add "SyntaxHighlighter_1.5.1.zip" to your classpath as if it were a JAR
file. You need to add all the JARs and ZIPs from the "lib" folder depending on
what feature you need.
Note that running the demo this way will not allow you to see any source file
when clicking on the "source" tab. This is because I have special scripts that
copy source files when I prepare the distribution of the demo (but you have
the sources anyway).
Hope this helps,
-Christopher
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi chriis, i have same problem. i develop a desktop app on windows and when i
run on mac i have exception ;
Uncaught exception in main method: java.lang.UnsatisfiedLinkError: Could not
load SWT library. Reasons:
no swt-win32-3721 in java.library.path
no swt-win32 in java.library.path
Can't load library: /Users/dilekd/.swt/lib/macosx/x86/libswt-win32-3721.jnilib
Can't load library: /Users/dilekd/.swt/lib/macosx/x86/libswt-win32.jnilib
could you help me pleas?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
SWT requires a different JAR for each platform. Have a look at the 3.7M5
releases of SWT, which are currently in use in the latest DJ Native Swing
distribution (note: there are more recent versions of SWT, official "3.7" is
out):
For Mac, you need the Cocoa version, either 32 bit or 64 bit. If you download
the 32 bit version, you can use it on a 64 bit JVM on Mac by running the JVM
with the "-d32" flag.
Hope this helps,
-Christopher
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Chriis,
How are you ? I am trying to use the DJ Native Swing library which has really
amazing capabilities Thanks. I am using eclipse on windows xp 32 bit. I am
trying to run the demos I am able to run the simplewebbrowser demo but when I
run the FullPageCaptureExample and try hitting the capture button I get the
following exception This same exception also occurs when I try to print the
contents of SimpleWebBrowser example to a page. Also when I run the online
example for FullPageCaptureExample the application freezes.
NativeSwing: Exception in thread "NativeSwing Component Image Data Transfer"
java.lang.IllegalStateException: Not implemented
NativeSwing: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent$CMN_get
ComponentImage.sendImageData(SWTNativeComponent.java:1505)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent$CMN_get
ComponentImage.access$1(SWTNativeComponent.java:1440)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent$CMN_get
ComponentImage$3.run(SWTNativeComponent.java:1445)
I highly appreciate your help. Thanks in advance
Regards
Vijay
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Are you on a system with limited number of colors on screen? What kind of
color model do you have?
The issue is that you are hitting some code which I never thought I would need
to implement. I could probably implement it but I want to better understand
the conditions in which this happens.
Cheers,
-Christopher
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I actually took a closer look and implemented the indexed color model.
Component printing should work now using the latest 1.0.2 preview
(DJNativeSwing-SWT-1-0-2-2011082).
Please let me know if it works as expected if you get to test it where it used
to fail (especially because I could not test my implementation).
Cheers,
-Christopher
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello chrriis , thanks for amazing components.
My english is not so good , but you will understand what i write to this post.
My environment is Netbeans 7.0 M2 .I have imported all jar files from your
project to libraries folder of my project that i have named DemoFrame.
My OS is ubuntu and when i run this , i get exception
I know that something is going on with my configuration but to me it's not
clear .Below is the code from DemoFrame .
What is wrong here with the code ?
Thank you very much for your project
Best regards George Tselios .
Hi George,
On Ubuntu, you need to use the Linux version of SWT. Here, you are using SWT
for Windows.
To get the appropriate SWT for your platform, please go to:
http://download.eclipse.org/eclipse/downloads/drops/S-3.7M3-201010281441/inde
x.php#SWT
Download, the right distribution, unzip "swt.jar" which you will use in your
classpath.
Hope this helps,
-Christopher
Hello chriis again .Thanks for the fast replay .Yes it's all ok now except one
thing more .I get this exception now
If you can send me an answear .
Best regards
George Tselios .
Hi George,
Please add "SyntaxHighlighter_1.5.1.zip" to your classpath as if it were a JAR
file. You need to add all the JARs and ZIPs from the "lib" folder depending on
what feature you need.
Note that running the demo this way will not allow you to see any source file
when clicking on the "source" tab. This is because I have special scripts that
copy source files when I prepare the distribution of the demo (but you have
the sources anyway).
Hope this helps,
-Christopher
!!!!! Correct .Thanks again chris
hi chriis, i have same problem. i develop a desktop app on windows and when i
run on mac i have exception ;
Uncaught exception in main method: java.lang.UnsatisfiedLinkError: Could not
load SWT library. Reasons:
no swt-win32-3721 in java.library.path
no swt-win32 in java.library.path
Can't load library: /Users/dilekd/.swt/lib/macosx/x86/libswt-win32-3721.jnilib
Can't load library: /Users/dilekd/.swt/lib/macosx/x86/libswt-win32.jnilib
could you help me pleas?
@amisorih I would hazard a guess at the fact you would need the mac SWT
library when running on a mac machine rather than the windows one.
Nick
how can i integrate mac SWT to IDE or jar file
Hi,
SWT requires a different JAR for each platform. Have a look at the 3.7M5
releases of SWT, which are currently in use in the latest DJ Native Swing
distribution (note: there are more recent versions of SWT, official "3.7" is
out):
http://archive.eclipse.org/eclipse/downloads/drops/S-3.7M5-201101272034/index
.php#SWT
For Mac, you need the Cocoa version, either 32 bit or 64 bit. If you download
the 32 bit version, you can use it on a 64 bit JVM on Mac by running the JVM
with the "-d32" flag.
Hope this helps,
-Christopher
Hi Chriis,
How are you ? I am trying to use the DJ Native Swing library which has really
amazing capabilities Thanks. I am using eclipse on windows xp 32 bit. I am
trying to run the demos I am able to run the simplewebbrowser demo but when I
run the FullPageCaptureExample and try hitting the capture button I get the
following exception This same exception also occurs when I try to print the
contents of SimpleWebBrowser example to a page. Also when I run the online
example for FullPageCaptureExample the application freezes.
NativeSwing: Exception in thread "NativeSwing Component Image Data Transfer"
java.lang.IllegalStateException: Not implemented
NativeSwing: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent$CMN_get
ComponentImage.sendImageData(SWTNativeComponent.java:1505)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent$CMN_get
ComponentImage.access$1(SWTNativeComponent.java:1440)
NativeSwing: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent$CMN_get
ComponentImage$3.run(SWTNativeComponent.java:1445)
I highly appreciate your help. Thanks in advance
Regards
Vijay
Hi Vijay,
Are you on a system with limited number of colors on screen? What kind of
color model do you have?
The issue is that you are hitting some code which I never thought I would need
to implement. I could probably implement it but I want to better understand
the conditions in which this happens.
Cheers,
-Christopher
Hi Vijay,
I actually took a closer look and implemented the indexed color model.
Component printing should work now using the latest 1.0.2 preview
(DJNativeSwing-SWT-1-0-2-2011082).
Please let me know if it works as expected if you get to test it where it used
to fail (especially because I could not test my implementation).
Cheers,
-Christopher