SWT Browser not working? - java

I'm having a little trouble with the SWT Browser component.
I am running Ubuntu 11.04 AMD64 and Eclipse 3.7, with Java SE 1.6 from Sun
My problem is that my browser won't initialize. When I make it with the SWT.NONE flag, I get errors
Exception in thread "main" org.eclipse.swt.SWTError: No more handles (java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3346 or swt-mozilla-gtk in swt.library.path, java.library.path or the jar file)
at org.eclipse.swt.SWT.error(SWT.java:3589)
at org.eclipse.swt.SWT.error(SWT.java:3481)
at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:324)
at org.eclipse.swt.browser.Browser.<init>(Browser.java:109)
at browser.Main.createGUI(Main.java:40)
at browser.Main.main(Main.java:21)
Caused by: java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3346 or swt-mozilla-gtk in swt.library.path, java.library.path or the jar file
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:219)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:151)
at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:309)
... 3 more
And then when I try to use the SWT.MOZILLA flag, I get
Exception in thread "main" org.eclipse.swt.SWTError: No more handles [Could not detect registered XULRunner to use]
at org.eclipse.swt.SWT.error(SWT.java:3589)
at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:280)
at org.eclipse.swt.browser.Browser.<init>(Browser.java:109)
at browser.Main.createGUI(Main.java:40)
at browser.Main.main(Main.java:21)
I suspect this is partly because I am using XULRunner2, but I would prefer to use WebKit, which in Eclipse 3.7 (that's why I upgraded), should be default when using SWT.NONE.
If any of you have run into this problem and/or have solved it before, I would appreciate it if you could help me.
Thanks!

According to SWT FAQ you may have unsupported XULRunner2 (try older versions). You should also check if you have installed WebKitGTK+ 1.2.x for WebKit browser core.
EDIT
Edited based on your comments. Accordingly to this FAQ you should have WebKitGTK 1.2.0 or newer in the library load path, so check if you have.. And create browser with SWT.NONE..
The error message you get from SWT said so you don't have the library on the path you should
java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3346 or swt-mozilla-gtk in swt.library.path, java.library.path or the jar file

Related

Why am I missing /System/Library/Frameworks/JavaVM.framework/Libraries/libjawt.dylib on MacOSX?

I have been trying to install Java3D 1.5.2 on my Mac (OS 10.10). First I tried using the installer referenced in this answer by whiskeyspider. It installed the files, but I got an error when I tried to run a program. So I cleared out /Library/Java/Extensions and tried to install manually in ~/.local/lib, a directory I created previously, and just include the jars in my project's build path (Eclipse). Despite including the jars and native library locations (for the JOGL jars) I get the following error when I try to run the program:
Exception in thread "J3D-Renderer-1" java.lang.UnsatisfiedLinkError: /Users/brianmc7/.local/lib/jogl/lib/libjogl_awt.jnilib: dlopen(/Users/brianmc7/.local/lib/jogl/lib/libjogl_awt.jnilib, 1): Library not loaded: /System/Library/Frameworks/JavaVM.framework/Libraries/libjawt.dylib
Referenced from: /Users/brianmc7/.local/lib/jogl/lib/libjogl_awt.jnilib
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at com.sun.opengl.impl.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:189)
at com.sun.opengl.impl.NativeLibLoader.access$000(NativeLibLoader.java:49)
at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:80)
at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:103)
at com.sun.opengl.impl.NativeLibLoader.access$200(NativeLibLoader.java:49)
at com.sun.opengl.impl.NativeLibLoader$2.run(NativeLibLoader.java:132)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.opengl.impl.NativeLibLoader.loadAWTImpl(NativeLibLoader.java:118)
at com.sun.opengl.impl.JAWT.getJAWT(JAWT.java:91)
at com.sun.opengl.impl.macosx.MacOSXOnscreenGLDrawable.lockSurface(MacOSXOnscreenGLDrawable.java:144)
at com.sun.opengl.impl.macosx.MacOSXOnscreenGLContext.makeCurrentImpl(MacOSXOnscreenGLContext.java:57)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
at javax.media.j3d.JoglPipeline$QueryCanvas.doQuery(JoglPipeline.java:9049)
at javax.media.j3d.JoglPipeline.getBestConfiguration(JoglPipeline.java:8797)
at javax.media.j3d.Renderer.doWork(Renderer.java:514)
at javax.media.j3d.J3dThread.run(J3dThread.java:275)
It turns out that the directory /System/Library/Frameworks/JavaVM.framework/Libraries/ doesn't exist. How can I fix this problem?
EDIT: I should probably also mention that I am using JDK 1.8.0_40 early access.
Java3D was abandoned by Sun Microsystems / Oracle in 2008. Java3D has been maintained by the JogAmp community since 2012. Yes, Java3D 1.6 is composed of several pre-releases but they work much better than Java3D 1.5.
My own tutorial explains in details how to install the very latest version of Java3D.

Getting "java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path" error using SAP jco 3.0.11 for 32 bit windows [duplicate]

This question already has an answer here:
Talend: java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
(1 answer)
Closed 5 years ago.
I am getting the below mentioned error while using SAPJCO 3.0.11 jar for 32 Bit windows XP OS. I am using a StepByStepClient example mentioned in the zip libarary when i downloaded the 32 but SAPJCO jar from market place.
The Jar I downloaded never had a dll file for 32 bit system.
please let me kow what i am missing and please help me to get this issues resolved.
Below is the error:
ava.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at com.sap.conn.jco.rt.DefaultJCoRuntime.loadJCoLibrary(DefaultJCoRuntime.java:772)
at com.sap.conn.jco.rt.DefaultJCoRuntime.registerNativeMethods(DefaultJCoRuntime.java:382)
at com.sap.conn.jco.rt.JCoRuntime.registerNatives(JCoRuntime.java:1200)
at com.sap.conn.rfc.driver.CpicDriver.<clinit>(CpicDriver.java:792)
at com.sap.conn.rfc.engine.DefaultRfcRuntime.getVersion(DefaultRfcRuntime.java:36)
at com.sap.conn.rfc.api.RfcApi.RfcGetVersion(RfcApi.java:238)
at com.sap.conn.jco.rt.MiddlewareJavaRfc.<clinit>(MiddlewareJavaRfc.java:217)
at com.sap.conn.jco.rt.DefaultJCoRuntime.initialize(DefaultJCoRuntime.java:98)
at com.sap.conn.jco.rt.JCoRuntimeFactory.<clinit>(JCoRuntimeFactory.java:23)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.sap.conn.jco.JCo.createJCo(JCo.java:52)
at com.sap.conn.jco.JCo.<clinit>(JCo.java:26)
at com.sap.conn.jco.JCoDestinationManager.getDestination(JCoDestinationManager.java:77)
at com.sap.connect.StepByStepClient.step1Connect(StepByStepClient.java:91)
at com.sap.connect.StepByStepClient.main(StepByStepClient.java:358)
Exception in thread "main" java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
Thanks, Rohit
First, and despite this connector is designed for Java, you should be aware that SAP Java Connector is not platform independent. You should have guessed it because there are different download links for each architecture in SAP's website.
So, the SAP Java Connector consists basically of two parts:
a sapjco3.jar file, for the java binding (platform independent).
a native library (an .so-file or .dll-file) for the platform specific binding.
To make your application work, just assure that both files are in the PATH (or CLASSPATH) of your app, and you're done.
If you're under Windows, copying the .dll file to \Windows\System32 will work, but a puppy dies every time you do so. If you love puppies, don't do that. Ever.
Better yet, it would be to always read the documentation. This is really a very good practice. The docs for SAP Java Connector 3.0 clearly states the following:
SAP Java Connector 3.0 :: Installation
...
Microsoft Windows
...
Note: Do not copy the sapjco3.dll neither into the {windows-dir}\system32 nor into the {windows-dir}\SysWOW64 directory. This will break the operability of other JCo versions that are already installed on the same system. Furthermore you would risk that the current installation also would not work anymore, if the sapjco3.dll gets replaced in the respective Windows system directory in the future.
Then add {sapjco3-path} to the PATH environment variable.
Finally, add {sapjco3-path}\sapjco3.jar to your CLASSPATH environment variable.
...
This means SAP developers love puppies.

Creating a SWT.MOZILLA browser on Windows 64 bit and SWT 4.3

I'm trying to create an SWT Browser widget of the SWT.MOZILLA type under windows 8 64Bit with SWT 4.3 64Bit.
According to this, SWT 4.3 should support 64 Bit version on XULRunner 10.x or 24.x
So, I have downloaded both the 10.x and 24.x 64 versions from here and unzipped under c:\xulrunner10 and c:\xulrunner24 respectively.
If I start my java app pointing to xulrunner10 (using the VM argument -Dorg.eclipse.swt.browser.XULRunnerPath=C:\xulrunner10) it works, however if I try with xulrunner24 (using the VM argument -Dorg.eclipse.swt.browser.XULRunnerPath=C:\xulrunner24) I get the follwoing error:
Exception in thread "main" org.eclipse.swt.SWTError: XPCOM error 0x80004005
at org.eclipse.swt.browser.Mozilla.error(Unknown Source)
at org.eclipse.swt.browser.Mozilla.initXULRunner(Unknown Source)
at org.eclipse.swt.browser.Mozilla.create(Unknown Source)
at org.eclipse.swt.browser.Browser.<init>(Unknown Source)
I also noticed that I get the same error if pointing to unexisting directory, however the folder c:\xulrunner24 exists and contains all the files as well as xulrunner.exe.
How can I make xulrunner 24.x 64bit embeddable in my swt 4.3 app?
Got it!
It's an error on SWT wiki: xulrunner 24.x requires SWT 4.4.
I've installed swt-4.4M5 and now I can embed xurlrunner 24 64bit
I realize that this question is old and already has an accepted answer, but the download location mentioned in the question is no longer valid (http://wiki.mozilla-x86-64.com/Download), and the same issue has been posted about several times.
With 64-bit 4.3 SWT I was able to fix this exception by using XULRunner version 1.9.2.25 runtimes. Originally I found the download from here: https://osdn.net/projects/sfnet_runawfe/downloads/SRC%20and%20BIN%20files/extras/xulrunner-1.9.2.25-win64.zip/
However, I have also re-hosted it as xulrunner-1.9.2.25.en-US.win64.zip.
Full explanation posted in my answer here: https://stackoverflow.com/a/44848877/3300205
Looks like this might be Eclipse bug 411996 (same error and stack trace).

no usbJava in java.library.path

I got a .jar file from a code that works on Windows, and I'm trying to run it on Linux, but I keep getting this message, and don't know what to do.
Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: no usbJava in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1856)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at ch.ntb.usb.LibusbJava.<clinit>(LibusbJava.java:366)
at ch.ntb.usb.USB.init(USB.java:315)
at ch.ntb.usb.USB.getBus(USB.java:296)
at ch.ntb.usb.Device.initDevice(Device.java:102)
at ch.ntb.usb.Device.open(Device.java:222)
at TransmitterModuleHIDInterface.run(TransmitterModuleHIDInterface.java:28)
at java.lang.Thread.run(Thread.java:722)
I'm using the Java wrapper for the libusb-0.1 (I followed the installation instructions here).
Any help would be really appreciated!
You need to create a link to the shared library, as per the Linux installation instructions:
http://libusbjava.sourceforge.net/wp/?page_id=8
If you're having trouble building the shared library this might be of some help:
http://me.opengroove.org/2010/01/libusbjavaso.html
The sources for the library itself is under /libusbjava/trunk/LibusbJava/ in the SVN source tree.

Can't find/load swt-gtk

I'm trying to run an internal web browser using JWebBrowser. When I run the application in Netbeans environment it works perfectly. However, when I build the project and run the jar file I'm getting the following error:
NativeSwing[1]: Exception in thread "main" java.lang.UnsatisfiedLinkError: Could
not load SWT library. Reasons:
NativeSwing[1]: no swt-gtk-3721 in java.library.path
NativeSwing[1]: no swt-gtk in java.library.path
NativeSwing[1]: Can't load library: C:\Users\CCS.swt\lib\win32\amd64\swt-gtk-3721.dll
NativeSwing[1]: Can't load library: C:\Users\CCS.swt\lib\win32\amd64\swt-gtk.dll
I'm including the following libraries to the project:
DJNativeSwing.jar
DJNativeSwing-SWT.jar
DJNativeSwing-SWTAPI.jar
DJNativeSwing-SWTCore.jar
MozillaInterfaces-1.8.1.3.jar
swt.jar (version 3.7M5 for 64 bits.)
jna_WindowUtils.jar
jna-3.2.4.jar
and they're referenced by Manifest.MF by this way
Class-Path: lib/DJNativeSwing-SWT.jar lib/DJNativeSwing-SWTAPI.jar lib
/DJNativeSwing-SWTCore.jar lib/MozillaInterfaces-1.8.1.3.jar lib/DJNa
tiveSwing.jar lib/swt.jar lib/jna-3.2.4.jar lib/jna_WindowUtils.jar
What am I doing wrong?
Thank you.
You need to specify the java.library.path in the java command and aim it at the path to your .dll files. For example,
java -Djava.library.path=lib -cp ...
Ok, I found the solution. The problem was about the dll generation. I was using 3.7m5 version, I downloaded a previous version (3.7) and the application ran properly.
Thank you for your help.
Regards.

Categories