Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Adding functions to OS.JAVA

Hello,

I'm new to swt development. I'm having issues with adding a new gtk wrapper to OS.java and was hoping someone could help?

@Fedora 20, gtk3.10

As part of the button-size issue (394534), I need to add an extra wrapper to OS.java.
I followed instructions:
https://www.eclipse.org/swt/jnigen.php

However, I'm running into UnsatisfiedLinkError.

My steps:

1) Added the following to OS.java
	/** @method flags=dynamic */
public static final native void _gtk_widget_set_margin_right(long /*int*/ widget, int margin); //LINFO Margin ++ func. public static final void gtk_widget_set_margin_right(long /*int*/ widget, int margin) {
		lock.lock();
		try {
			_gtk_widget_set_margin_right(widget,margin);
		} finally {
			lock.unlock();
		}
	}

//Note, gtk_widget_set_margin_right is deprecated as of gtk3.12. But since I'm using gtk3.10, for the time being I thought I'd use this guy first.

2) Cleaned all projects
3) ran build.xml from org.eclipse.swt.gtk.linux.x86_64/build.xml
  	- the following were selected:
   		 build.jars
    	 build_libraries

  	Build fails with:
/home/lufimtse/git/eclipse.platform.swt/bundles/org.eclipse.swt/buildSWT.xml:928: The following error occurred while executing this line: /home/lufimtse/git/eclipse.platform.swt/bundles/org.eclipse.swt/buildSWT.xml:900: javax.script.ScriptException: ReferenceError: "importClass" is not defined in <eval> at line number 3

4) Open terminal. Export vars:
export JAVA_HOME=/usr/lib/jvm/java/
export GTK_VERSION=3.0

5) Re-build wrappers.
cd ~/git/eclipse.platform.swt/bundles/org.eclipse.swt/bin/library/
sh ./build.sh

6) Copy new .so's across:
cp -v ~/git/eclipse.platform.swt/bundles/org.eclipse.swt/bin/library/*.so ~/git/eclipse.platform.swt.binaries/bundles/org.eclipse.swt.gtk.linux.x86_64/

When I attempt to run my program that calls the native function, I get an unsatisfied link exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: org.eclipse.swt.internal.gtk.OS._gtk_widget_set_margin_right(JI)V at org.eclipse.swt.internal.gtk.OS._gtk_widget_set_margin_right(Native Method) at org.eclipse.swt.internal.gtk.OS.gtk_widget_set_margin_right(OS.java:14565)
	at org.eclipse.swt.widgets.DateTime.createText(DateTime.java:139)
	at org.eclipse.swt.widgets.DateTime.<init>(DateTime.java:122)
at org.eclipse.swt.examples.controlexample.DateTimeTab.createExampleWidgets(DateTimeTab.java:65) at org.eclipse.swt.examples.controlexample.Tab.createTabFolderPage(Tab.java:1307) at org.eclipse.swt.examples.controlexample.ControlExample.<init>(ControlExample.java:60) at org.eclipse.swt.examples.controlexample.ControlExample.main(ControlExample.java:217)


Thoughts?

Thank you

Leo Ufimtsev | Red Hat



Back to the top