Thread: [Java-gnome-developer] java.lang.UnsatisfiedLinkError: gnome_date_edit_new
Brought to you by:
afcowie
From: Jason P. <ja...@wi...> - 2003-10-25 23:49:01
|
Hi everyone, I recently installed java-gnome(had a problem building because I didn't have ANT installed) compiled and ran the example code. Everything went well. I am interested in the DateEdit class. I edited the EntryDemo.java example.... http://java-gnome.sourceforge.net/docs/GNOME-tutorial/c688.html#ENTRY to the following.... import org.gnu.gnome.DateEdit; import org.gnu.gtk.Gtk; import org.gnu.gtk.HBox; import org.gnu.gtk.Widget; import org.gnu.gtk.Window; import org.gnu.gtk.WindowType; import org.gnu.gtk.event.LifeCycleEvent; import org.gnu.gtk.event.LifeCycleListener; import java.util.Date; public class DateEditDemo { public static void main(String[] args) { boolean thetruth = true; Gtk.init(args); Window w = new Window(WindowType.TOPLEVEL); w.addListener(new LifeCycleListener() { public void lifeCycleEvent(LifeCycleEvent event) { if (event.isOfType(LifeCycleEvent.Type.DESTROY) || event.isOfType(LifeCycleEvent.Type.DELETE)) { Gtk.mainQuit(); } } }); w.setDefaultSize(200,200); w.setBorderWidth(5); w.setTitle("DateEdit Demo!!!"); w.add(new DateEdit(new Date(), thetruth, thetruth )); w.showAll(); Gtk.main(); } } the code compiles fine and when launched I get the following.... Exception in thread "main" java.lang.UnsatisfiedLinkError: gnome_date_edit_new at org.gnu.gnome.DateEdit.gnome_date_edit_new(Native Method) at org.gnu.gnome.DateEdit.<init>(DateEdit.java:52) at DateEditDemo.main(DateEditDemo.java:27) I have only worked a little bit with Java Native Interface so I don't know where to start. A little research suggests the following in DateEdit.java... native static final protected int gnome_date_edit_new(long the_time, boolean show_time, boolean use_24_format); should be changed to the following along with the supporting code but I am not sure.... native static final protected int gnome_date_edit_new(int the_time, int show_time, int use_24_format); gnome_date_edit_new suggests that "the_time" in an unsigned long (32 bits) not java long (64 bits) and the show_time and use_24_format are int not boolean. But again I am very new to JNI.. I made the changes but got the same error UnsatisfiedLinkError I'm I way off? Thanks, Jason Peterson -- ja...@wi... |
From: Jeffrey M. <ku...@zo...> - 2003-10-26 11:36:11
|
I believe the UnsatisfiedLinkError means something else. It typically means that the java runtime could not find a method on a native library when it tried to make a call. In this case the error is not that the java-gnome libraries could not be found but that the gnome libraries were not initialized and loaded properly. If you add the following line: Program.initGnomeUI("DateEditDemo", "1.0", args); just prior to the call to Gtk.init and include the Program import your example will work. -Jeff On Sat, 2003-10-25 at 07:42, Jason Peterson wrote: > Hi everyone, > > I recently installed java-gnome(had a problem building because I didn't > have ANT installed) compiled and ran the example code. Everything went > well. I am interested in the DateEdit class. I edited the > EntryDemo.java example.... > > http://java-gnome.sourceforge.net/docs/GNOME-tutorial/c688.html#ENTRY > > to the following.... > > > import org.gnu.gnome.DateEdit; > import org.gnu.gtk.Gtk; > import org.gnu.gtk.HBox; > import org.gnu.gtk.Widget; > import org.gnu.gtk.Window; > import org.gnu.gtk.WindowType; > import org.gnu.gtk.event.LifeCycleEvent; > import org.gnu.gtk.event.LifeCycleListener; > import java.util.Date; > public class DateEditDemo { > > public static void main(String[] args) { > boolean thetruth = true; > Gtk.init(args); > Window w = new Window(WindowType.TOPLEVEL); > w.addListener(new LifeCycleListener() { > public void lifeCycleEvent(LifeCycleEvent event) { > if (event.isOfType(LifeCycleEvent.Type.DESTROY) || > event.isOfType(LifeCycleEvent.Type.DELETE)) { > Gtk.mainQuit(); > } > } > }); > w.setDefaultSize(200,200); > w.setBorderWidth(5); > w.setTitle("DateEdit Demo!!!"); > w.add(new DateEdit(new Date(), thetruth, thetruth )); > w.showAll(); > Gtk.main(); > } > } > > > the code compiles fine and when launched I get the following.... > > > Exception in thread "main" java.lang.UnsatisfiedLinkError: > gnome_date_edit_new > at org.gnu.gnome.DateEdit.gnome_date_edit_new(Native Method) > at org.gnu.gnome.DateEdit.<init>(DateEdit.java:52) > at DateEditDemo.main(DateEditDemo.java:27) > > I have only worked a little bit with Java Native Interface so I don't > know where to start. A little research suggests the following in > DateEdit.java... > > native static final protected int gnome_date_edit_new(long the_time, > boolean show_time, boolean use_24_format); > > should be changed to the following along with the supporting code but I > am not sure.... > > native static final protected int gnome_date_edit_new(int the_time, int > show_time, int use_24_format); > > gnome_date_edit_new suggests that "the_time" in an unsigned long (32 > bits) not java long (64 bits) and the show_time and use_24_format are > int not boolean. But again I am very new to JNI.. I made the changes > but got the same error UnsatisfiedLinkError > > > I'm I way off? > > Thanks, > > Jason Peterson -- ja...@wi... > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: The SF.net Donation Program. > Do you like what SourceForge.net is doing for the Open > Source Community? Make a contribution, and help us add new > features and functionality. Click here: http://sourceforge.net/donate/ > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer -- Jeffrey Morgan <ku...@zo...> |