3

It seems that SWT (eclipse based) applications in Xenial (16.04) are mostly broken with default-jdk (ie openjdk 8). This includes Eclipse IDE, Gantproject, etc...

They either won't load, or won't work as expected (never ending operations, ...). This is related to the fact that SWT integrates badly with GTK3, and especialy the latest version that ships with Xenial (look for SWT GTK3 in Google for tons of problems and blogs related to the issue).

Most of the time, export SWT_GTK3=0 works around the issue (it falls back to GTK2).

So here is my question: what is the best way to handle this problem for Xenial ?

  • set SWT_GTK3=0 globally for the system (then how is it best done, /etc/bash.bashrc, /etc/environment, ???) ?
  • report the problem to Ubuntu to get it solved before the release ? Then, what are the relevant packages ? (default-jdk, swt-gtk, ???) Notice a bug report already exists on the subject: https://bugs.launchpad.net/ubuntu/+source/swt-gtk/+bug/1552764, which I edited to make it more generic and not eclipse IDE only
  • any other option ?
user.dz
  • 48,105
alci
  • 5,839

2 Answers2

1

The problem has already been reported to Ubuntu at the link you provided, so nothing more needs to be done there just yet.

If SWT_GTK3=0 works well, you should set it as unglobally as is feasible. There are a few ways to do it (choose the last one that will work for your situation):

  • /etc/environment applies to everything for every user, not just Java programs
  • /etc/bash.bashrc applies to things started from bash for every user, not just Java.
  • ~/.bashrc applies to things started from bash for the current user, not just Java.
  • The following will apply to things started from bash for every user using the java command. Press Ctrl+Alt+T and run the following:
    sudo -i
    mkdir -p /usr/local/bin
    echo '#!/bin/sh' > /usr/local/bin/java
    echo 'SWT_GTK3=0 /usr/bin/java $*' >> /usr/local/bin/java
    chmod a+x /usr/local/bin/java
    exit
    exit
  • The following will apply to things started from bash for the current user using the java command. Press Ctrl+Alt+T and run the following:
    mkdir -p ~/bin
    echo '#!/bin/sh' > ~/bin/java
    echo 'SWT_GTK3=0 /usr/bin/java $*' >> ~/bin/java
    chmod a+x ~/bin/java
    exit
Olathe
  • 4,240
0

I just got winbuilder designer to work this morning. I will share.

Install oracle jdk8 and remove open jdk. To purge do this command.

sudo apt-get purge openjdk-\*

To install oracle jdk use the ppa and installer instructions. The complex manual method and ppa method are found here. (And google can help too if needed) Replace openjdk with oracle-jdk on Ubuntu

  • Do you mean that SWT under Oracle JDK8 handles GTK3 better than OpenJDK8 ? – alci Mar 29 '16 at 13:41
  • 1
    Yup! try it. I did the same thing. It is a pisser because I want to install netbeans and I need open jdk for that. I do not have much room for both oracle and open jdk. also there is a setup issue for using either as default. – Bhikkhu Subhuti Mar 30 '16 at 23:32
  • Thanks for the tip. I am quite reluctant to install / use non free software, and try to avoid it whenever possible. The SWT_GTK3=0 workaround fits me better than usning the non free Oracle JDK for now. – alci Apr 01 '16 at 08:54
  • did it the other solution work? – Bhikkhu Subhuti Apr 01 '16 at 22:28
  • Yes it did (I'm using the /etc/environment method) – alci Apr 02 '16 at 06:14