(See update at bottom for new information.)
I have a Java SWT application that includes an integrated browser.
Everything works fine on Windows and on CENTOS 6.5. I was asked to get the application to work on a new computer to which I installed CENTOS 7.
I keep receiving the no swt-mozilla-gtk-4332 in java.library.path error message.
I am aware of the various pages that talk on this issue. For instance:
StackOverflow 10165693, 6518568, 7130980
I am using Firefox 24.8.0. That came with CENTOS 7. I just updated all the software too.
The references indicated that I should have OpenJDK, which I do. That is the only version that can execute Java.
I installed per another recommendation xulrunner (yum install xulrunner).
I set: MOZILLA_FIVE_HOME=/usr/lib/mozilla (Some say to use that others say not to. I tried both. Also, one issue said to point to that to "/usr/lib64/xulrunner" less the double quotes, but that did not work. Yes, this folder exists.)
587 people and counting gave thumbs up to the Ubuntu solution of:
ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/
There is no jni folder, and any ways that option did not work.
As I mentioned there is only one a program, so
sudo update-alternatives --config java
was of no use.
What could the problem be and how to solve it? Since the CENTOS 6.5 machine works (maybe because of a missing software package?) and 7 does not, it cannot be just that I need to add something to my jar file, as it worked before.
Note: here is my /etc/profile.d/java.sh file content:
export MOZILLA_FIVE_HOME=/usr/lib/mozilla
export LD_LIBRARY_PATH=${MOZILLA_FIVE_HOME}:${LD_LIBRARY_PATH}
Here is the actual error output.
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: org.eclipse.swt.SWTError: No more handles [MOZILLA_FIVE_HOME='/usr/lib/mozilla'] (java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-mozilla-gtk-4332 in java.library.path
no swt-mozilla-gtk in java.library.path
/home/hts/.swt/lib/linux/x86_64/libswt-mozilla-gtk-4332.so: libxpcom.so: cannot open shared object file: No such file or directory
Can't load library: /home/hts/.swt/lib/linux/x86_64/libswt-mozilla-gtk.so
)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.browser.Mozilla.initMozilla(Unknown Source)
at org.eclipse.swt.browser.Mozilla.create(Unknown Source)
at org.eclipse.swt.browser.Browser.<init>(Unknown Source)
at prjNetAccelerator.AppMain.createContents(Unknown Source)
at prjNetAccelerator.AppMain.open(Unknown Source)
at prjNetAccelerator.AppWrapper.doLaunch(Unknown Source)
at prjNetAccelerator.AppWrapper.main(Unknown Source)
... 5 more
Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-mozilla-gtk-4332 in java.library.path
no swt-mozilla-gtk in java.library.path
/home/hts/.swt/lib/linux/x86_64/libswt-mozilla-gtk-4332.so: libxpcom.so: cannot open shared object file: No such file or directory
Can't load library: /home/hts/.swt/lib/linux/x86_64/libswt-mozilla-gtk.so
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
... 12 more
Update
The error text showed the problem, namely that the system could not find libxpcom.so. Mozilla (xulruntime) in version 22.0 replaced the files, libxpcom.so and mozsqlite3.so, with libxul.so. The file, libsmozsqlite3.so stayed for a few more versions than disappeared as well. All other files are the same as version 28.x, which is the current version as of today (2014.09.18).
The integrated SWT browser for some reason wants the older version, even though it is not there. The questions are:
- What is the mechanism that SWT determines which version of the Gecko GTK+ / xulrunner to use?
- Would a newer version of SWT, although I thought that my version with Eclipse Kepler was current, solve the problem?
- How do I get SWT to target the new version?
- Is the problem Firefox or Chrome or what related?
I understand most of the problem now, but not all of it.
I see that Eclipse is at Luna now, so that may solve the problem, have to check. That usually means an updated SWT library. I really thought that Java was version independent, but I guess not entirely.