3

(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

Jazz.net, Eclipse.org

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.

Community
  • 1
  • 1
Sarah Weinberger
  • 15,041
  • 25
  • 83
  • 130
  • Did you actually download the Linux version of SWT? There are different builds of SWT for each platform. – greg-449 Sep 18 '14 at 07:31
  • There are not only different builds of SWT for each OS but each architecture too (X86 and X64). The jar file that I use includes all SWT variants and I load the appropriate one at run time. That part works flawlessly, even on Linux. The problem here is the GTK+ for whatever reason. I did not include that component, hence the build path warning, as Firefox comes with the OS. I installed the necessary components. It is there to the best of my knowledge, just not using it. – Sarah Weinberger Sep 18 '14 at 12:05
  • If the SWT version was incompatible or the problem, the error message would be totally different. I know. I already been there and done that. – Sarah Weinberger Sep 18 '14 at 12:06
  • The key, like in question 6418568, is the unsatisfied link error. The person that answered that said the problem in that case might be an unsupported XulRunner. I did upgrade to CENTOS 7, so possibly the version that I have is too new, but hard to check. I do not want to downgrade, as I am on 7, not 6.5 and that could cause other issues, if that is even the problem. – Sarah Weinberger Sep 18 '14 at 18:09
  • @SarahWeinberger Not sure which SWT version you're using, but it might be worth a try to use the [latest one](http://download.eclipse.org/eclipse/downloads/drops4/R-4.4-201406061215/#SWT) (if you aren't already). – Baz Sep 19 '14 at 07:59
  • That was the answer. Yay! I had SWT v4.3, and updated to SWT v4.4 and that did the trick. When I went to eclipse.org/SWT I say that it said "SWT/GTK+". SWT comes integrated with GTK, which is what I thought, and you have to have a matching component on Linux. Thanks Baz, you should put your comment as an answer, then you can get some points. :) – Sarah Weinberger Sep 19 '14 at 15:51
  • @SarahWeinberger If you add a "@Baz" to your comment, I'll get notified, otherwise I won't know you posted a reply to my comment. – Baz Sep 22 '14 at 07:52
  • @Baz, Sorry about that. I thought that once you post a comment, all participants get notified. – Sarah Weinberger Sep 22 '14 at 11:56
  • @SarahWeinberger I think if there's just one person (other than you) who posted a comment, then it works without the "@", otherwise I think you have to specify the recipient. – Baz Sep 22 '14 at 11:58

6 Answers6

7

i just had this same error on Ubuntu 14.04 and solved it by installing an older version:

sudo apt-get install libwebkitgtk-1.0-0

libwebkitgtk-3.0-0 was already installed

marengaz
  • 1,639
  • 18
  • 28
3

For Linux Mint 19 it worked with this (same as marengaz' answer)

sudo apt-get install libwebkitgtk-1.0-0
Reitenator
  • 1,075
  • 13
  • 13
1

I was on SWT/GTK+ v4.3 and needed to download and update to SWT/GTK+ v4.4 (or the beta of v4.5), which supports the new GTK+ introduced in GTK version v22.* and present in CENTOS 7. See comment from Baz and myself.

Sarah Weinberger
  • 15,041
  • 25
  • 83
  • 130
1

I tried something like

sudo yum install libwebkitgtk-1.0-0

on fedora 28 and I got this message

" Last metadata expiration check: 0:33:01 ago on Wed 02 Jan 2019 06:38:13 PM -02. No match for argument: libwebkitgtk-1.0-0 Error: Unable to find a match "

As a read in this post

https://community.hitachivantara.com/thread/13998-problems-with-libwebkitgtk-10-0

There is no suport for version 1 of libwebkitgtk on fedora

0

sudo apt-get install libwebkitgtk-1.0-0

I tested many java versions, think that it was java. But what really makes sense was to install libwebkitgtk for versions 7.1 and 8.0 of pentaho data integration.

WMS
  • 106
  • 1
  • 4
0

You'll have to install libwebkitgtk as everyone has said. But now in the updated version of linux mint and ubuntu it is not being installed. To solve this problem see :How to install the libwebkitgtk package on Ubuntu 20.04 LTS?

Following the steps here fixed the issue for me:

  1. Open terminal and write this:

sudo nano /etc/apt/sources.list

  1. Add this entry to the file and save:

    deb http://cz.archive.ubuntu.com/ubuntu bionic main universe

  2. sudo apt-get update

  3. sudo apt-get install libwebkitgtk-1.0-0 -> if you are using Vega and jdk of 64 bits

sudo apt-get install libwebkitgtk-1.0-0:i386 -> if you are using Vega and jdk of 32 bits

Zubayer
  • 571
  • 1
  • 8
  • 16