Thread: [Java-gnome-developer] Problem running glade program
Brought to you by:
afcowie
From: Abcdefg <ab...@so...> - 2004-12-17 18:04:34
|
Hi, I'm trying to run this java/glade program but it doesn't work http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/GladeGUIS Where can I find documentation for java/glade/gtk? In the documentation page are a lot of dead links: http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/HintsAndTips so this isn't useful.. Here's what I tried: copied the glade file and java file and putted them in the files SimpleGladeExample.java and example1.glade and removed the // lines then compile (javac SimpleGladeExample.java or gcj --main=SimpleGladeExample SimpleGladeExample.java) The errors are: SimpleGladeExample.java:19: cannot resolve symbol symbol : variable glade location: class SimpleGladeExample glade = new LibGlade(inputStream, this, gladeRoot); ^ SimpleGladeExample.java:33: non-static variable PROGRAM_NAME cannot be referenced from a static context Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); ^ SimpleGladeExample.java:33: non-static variable PROGRAM_VERSION cannot be referenced from a static context Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); ^ SimpleGladeExample.java:35: cannot resolve symbol symbol : variable Gtk location: class SimpleGladeExample Gtk.main(); ^ 4 errors So in the code: import java.io.*; import org.gnu.glade.*; import org.gnu.gnome.*; public class SimpleGladeExample { private final String PROGRAM_NAME = "Glade Example"; private final String PROGRAM_VERSION = "1.0"; private final String gladeFile = "example1.glade"; private final String gladeRoot = "glade_root_element"; private LibGlade libGlade; public SimpleGladeExample() { try { InputStream inputStream = getClass().getResourceAsStream(gladeFile); glade = new LibGlade(inputStream, this, gladeRoot); } catch (GladeXMLException e) { e.printStackTrace(); System.exit(-1); } catch (FileNotFoundException e) { e.printStackTrace(); System.exit(-1); } catch (IOException e) { e.printStackTrace(); System.exit(-1); } } public static final void main(String[] args) { Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); SimpleGladeExample example = new SimpleGladeExample(); Gtk.main(); } } I changed private LibGlade libGlade; to private LibGlade glade; ..... But then when I compile tihs are the errors: SimpleGladeExample.java:33: non-static variable PROGRAM_NAME cannot be referenced from a static context Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); ^ SimpleGladeExample.java:33: non-static variable PROGRAM_VERSION cannot be referenced from a static context Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); ^ SimpleGladeExample.java:35: cannot resolve symbol symbol : variable Gtk location: class SimpleGladeExample Gtk.main(); ^ 3 errors Thanks for your help in advance, David |
From: Abcdefg <ab...@so...> - 2004-12-17 19:03:01
|
Hi, I understand that you are doing this in your free time and I appreciate this. Sorry if my mail looked like a flame. I changed the file and compiling now works! but now I get an error when I run it: $ java SimpleGladeExample (java-gnome:7634): GConf-CRITICAL **: file gconf-client.c: line 547 (gconf_client_add_dir): assertion `gconf_valid_key (dirname, NULL)' failed org.gnu.glade.GladeXMLException: <property> element should be empty. Found <b>. at org.gnu.glade.LibGlade.glade_xml_new_from_buffer(Native Method) at org.gnu.glade.LibGlade.<init>(LibGlade.java:123) at SimpleGladeExample.<init>(SimpleGladeExample.java:20) at SimpleGladeExample.main(SimpleGladeExample.java:35) I don't have gnome installed (I use xfce), could this be the reason? I don't need gnome for glade, do I? Thanks, David |
From: Benjamin P. J. <bp...@te...> - 2004-12-18 16:19:17
|
David, I was the one who put up the little Glade example. I know that it is far from finished but I realized that there were no other useful examples anywhere.... well: that's why I thought: better my more or less useless stuff than nothing.... :-) There are some good tutorials on how to actually RUN java-gnome programs. For the simple example I've put online you need the gnome libraries! You can start the example like this: JNI=3D/usr/lib/jni CP=3D/usr/share/java CLASSPATH=3D$CLASSPATH:$CP/gnome2.8.jar:$CP/gtk2.4.jar:$CP/glade2.4.jar LD_LIBRARY_PATH=3D$JNI CLASSPATH=3D$CLASSPATH java SimpleGladeExample My $JNI (/usr/lib/jni) contains the files: libgnomejava2.8.so libgtkjava2.4.so libgladejava2.4.so My $CP (/usr/share/java) contains: gnome2.8.jar gtk2.4.jar glade2.8.jar If you're missing any of the files (or you're using much older versions) the program will likely be failing. If I find the time I'll put up an example that's a bit simpler and won't utilize the gnome libraries.... Oh... and by the way. Mark was right: I had so much trouble converting "<" and ">" that I accidentaly left some bugs in the example... dunno how the two 'static's got lost :-) Have fun. Benjamin PS: By the way: if any of you guys who really know how to handle java-gnome (see... I just started using it and really dunno much 'bout it, yet!) could have a look at what I wrote concerning threads? http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/MultiThreaded Just in case that's stuuupid, too :-) > Hi, >=20 > I understand that you are doing this in your free time and I appreciate > this. Sorry if my mail looked like a flame. >=20 > I changed the file and compiling now works! but now I get an error when I > run it: >=20 > $ java SimpleGladeExample >=20 > (java-gnome:7634): GConf-CRITICAL **: file gconf-client.c: line 547 > (gconf_client_add_dir): assertion `gconf_valid_key (dirname, NULL)' faile= d > org.gnu.glade.GladeXMLException: <property> element should be empty. Fou= nd > <b>. > at org.gnu.glade.LibGlade.glade_xml_new_from_buffer(Native Method) > at org.gnu.glade.LibGlade.<init>(LibGlade.java:123) > at SimpleGladeExample.<init>(SimpleGladeExample.java:20) > at SimpleGladeExample.main(SimpleGladeExample.java:35) >=20 > I don't have gnome installed (I use xfce), could this be the reason? I do= n't > need gnome for glade, do I? >=20 > Thanks, > David |
From: Mark H. <mh...@ti...> - 2004-12-19 10:07:46
|
On Sat, Dec 18, 2004 at 05:18:30PM +0100, Benjamin P. Jung wrote: > PS: > By the way: if any of you guys who really know how to handle java-gnome > (see... I just started using it and really dunno much 'bout it, yet!) > could have a look at what I wrote concerning threads? > http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/MultiThreaded > Just in case that's stuuupid, too :-) Looks fine --=20 .''`. Mark Howard : :' : `. `' http://www.tildemh.com=20 `- mh...@de... | mh...@ti...=20 |
From: Joao V. <jvi...@ya...> - 2004-12-19 15:15:31
|
Guys, Java-Gnome is needing some better skin... it's a hard to read a text like that, so badly formatted. And things are a little bit too grey-ish... could use some white background (white is great for reading). If you want i could even help with the css stuff. Cheers, J.V. --- Mark Howard <mh...@ti...> escreveu: > On Sat, Dec 18, 2004 at 05:18:30PM +0100, Benjamin P. Jung wrote: > > PS: > > By the way: if any of you guys who really know how to handle java-gnome > > (see... I just started using it and really dunno much 'bout it, yet!) > > could have a look at what I wrote concerning threads? > > http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/MultiThreaded > > Just in case that's stuuupid, too :-) > > Looks fine _______________________________________________________ Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. http://br.acesso.yahoo.com/ - Internet rápida e grátis |
From: Mark H. <mh...@ti...> - 2004-12-17 18:19:30
|
Hi, We're currently in the process of updating how we do documentation. The website unfortuntately has broken links. We are fixing them, but slowly since we're only doing this in our free time. The old java-gnome tutorial used to be the only docs we had. The wiki and HintsAndTips page is an attempt to improve the situation by allowing anybody to add and edit documents. In this case, the author clearly hasn't even tried to comile the code. Please do correct the errors on the wiki page. On Fri, Dec 17, 2004 at 07:04:27PM +0100, Abcdefg wrote: > I changed all correct > > But then when I compile tihs are the errors: > SimpleGladeExample.java:33: non-static variable PROGRAM_NAME cannot be > referenced from a static context > Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); > ^ > SimpleGladeExample.java:33: non-static variable PROGRAM_VERSION cannot be > referenced from a static context > Program.initGnomeUI(PROGRAM_NAME, PROGRAM_VERSION, args); adding the keyword static to the field declarations for those will fix this ^ > SimpleGladeExample.java:35: cannot resolve symbol > symbol : variable Gtk > location: class SimpleGladeExample > Gtk.main(); add import org.gnu.gtk.*; -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... |