JDK-8088966 : [SWT, Linux, GTK3] FxCanvas can't handle gtk3 libs
  • Type: Bug
  • Component: javafx
  • Sub-Component: swing
  • Affected Version: 7u6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2014-01-10
  • Updated: 2015-07-28
  • Resolved: 2015-07-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Description
Eclipse Luna force loads gtk3 libs on Linux / Unix -  https://bugs.eclipse.org/bugs/show_bug.cgi?id=420182
Every time after running the above sample against gtk3 libs, the native error will appear. 

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import javafx.embed.swt.FXCanvas;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;

public class JavaFxBrowser extends FXCanvas {

	public JavaFxBrowser(Composite parent) {
		super(parent, SWT.NONE);
		WebView browser = new WebView();
		this.setScene(new Scene(browser));
		WebEngine webEngine = browser.getEngine();
		webEngine.load("http://www.oracle.com");	
	}
	
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());
		JavaFxBrowser javaFxBrowser = new JavaFxBrowser(shell);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}

SWT_GTK3=1 -  this environmental variable should be added 
Comments
Closing as a dup of JDK-8089584 which contains the same workaround.
28-07-2015

I ran ldd for libjfxwebkit.so, and I see that it doesn't link to GTK libraries. However, libjfxmedia.so does, so if you play any media files (either directly, or on a webpage open in webkit), then the GTK2 libraries will be loaded.
14-05-2014

There is no plan to move to gtk3 at this point. If we move to gtk3, FX will no longer be compatible with AWT/Swing which uses GTK2. The monocle port uses only X11 and this could be investigated, however, things like Drag and Drop are unlikely to work. It might be possible to run AWT/Swing and not reference any GTK libraries (I believe they are used mostly for look and feel). This would mean that AWT/Swing would only reference X.
14-05-2014

Yes, eclipse Luna *currently* can switch to GTK2 mode but that is not likely to last and on newer linux distributions gtk2 might not actually be present.
16-01-2014

Yeah, that's me who created that thread ^ As I understand JavaFx Webkit also compiled against gtk 2, right? >Is there such a flag? Yes, SWT_GTK3=0
16-01-2014

Related JavaFX forum thread: https://community.oracle.com/thread/2619718 "How to run javaFx application against gtk 3 libs?"
15-01-2014

JavaFX uses GTK2 libraries and is unlikely to switch in the near future. As long as there is a flag in Eclipse to use GTK2, then that flag can be set and SWT interop will work until we can move to GTK3. Is there such a flag?
15-01-2014