Re: [Java-gnome-developer] how to specify classpath
Brought to you by:
afcowie
From: Andrew C. <an...@op...> - 2008-07-01 01:39:57
|
I assume you had a look at the README file that comes with java-gnome. It has further examples of running code: http://java-gnome.sourceforge.net/4.0/README.html#using but the problem you're having is fairly simple to address. On Tue, 2008-07-01 at 04:12 +0900, 한정훈 wrote: > $ javac ExamplePressMe.java -classpath /usr/share/java Although Java searches paths for hierarchies of .class files, it does not load .jar files. You have to specify them by name. $ cd doc/examples/ $ javac -classpath /usr/share/java/gtk-4.0.jar button/ExamplePressMe.java And to run it, $ java -client -ea -classpath /usr/share/java/gtk-4.0.jar:. button.ExamplePressMe [You may need to add -Djava.library.path=/usr/lib/jni on Debian; I'm not sure if that's on the default system linker search path] Yes, this is all a bit verbose, but unfortunately that's the way Java is. ++ Or you could do it all from another location: $ javac -classpath /usr/share/java/gtk-4.0.jar -d /tmp/examples /path/to/java-gnome/doc/examples/button/ExamplePressMe.java $ java -client -ea -classpath /usr/share/java/gtk-4.0.jar:/tmp/examples -Djava.library.path=/usr/lib/jni button.ExamplePressMe Hopefully you see the pattern now. ++ If you were build java-gnome from source yourself, you would find that `make test` also builds the example code (and puts the resulting .class files in tmp/tests/). so, $ java -client -ea -classpath tmp/gtk-4.0.jar:tmp/tests/ -Djava.library.path=tmp button.ExamplePressMe would run it for you. Good luck, AfC Sydney -- Andrew Frederick Cowie Operational Dynamics is an operations and engineering consultancy focusing on IT strategy, organizational architecture, systems review, and effective procedures for change management. We actively carry out research and development in these areas on behalf of our clients, and enable successful use of open source in their mission critical enterprises, worldwide. http://www.operationaldynamics.com/ Sydney New York Toronto London |