README 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. This directory contains example programs that show how the GNU Classpath
  2. library can be used.
  3. Each example has its own package under gnu.classpath.examples and has a
  4. class Demo which contains a main() method to run that particular example.
  5. The examples can be compiled and run with gcj as follows:
  6. gcj -o swingdemo --main=gnu.classpath.examples.swing.Demo \
  7. gnu/classpath/examples/swing/Demo.java \
  8. gnu/classpath/examples/swing/GNULookAndFeel.java
  9. ./swingdemo
  10. Or with a traditional byte code interpreter like:
  11. gcj -C gnu/classpath/examples/awt/Demo.java
  12. gij gnu.classpath.examples.awt.Demo
  13. The installation also comes with an examples.zip archive that contains
  14. all needed resources and compiled byte code class files that can be
  15. run as follows:
  16. kaffe -classpath examples.zip gnu.classpath.examples.awt.Demo
  17. kaffe -classpath examples.zip gnu.classpath.examples.swing.Demo
  18. The jawt Demo needs some extra support library that currently needs to be
  19. build by hand. The following assumes GNU Classpath was installed in
  20. /usr/local/classpath, if you installed it somewhere else then adjust the
  21. -I and -L paths accordingly. The included Makefile.jawt is setup this way.
  22. You can invoke it with:
  23. make -f Makefile.jawt
  24. Or you can compile by hand as follows:
  25. gcj -C gnu/classpath/examples/jawt/DemoJAWT.java
  26. gcjh -jni gnu.classpath.examples.jawt.DemoJAWT -o DemoJAWT.h
  27. gcc -g -O0 -Wall -I. -I/usr/X11R6/include -L. -L/usr/X11R6/lib \
  28. -I/usr/local/classpath/include -L/usr/local/classpath/lib/classpath \
  29. -lX11 -ljawtgnu -shared -o libDemoJAWT.so \
  30. gnu/classpath/examples/jawt/DemoJAWT.c
  31. You can then run the example as follows:
  32. export LD_LIBRARY_PATH=.:/usr/local/classpath/lib/classpath
  33. jamvm gnu.classpath.examples.jawt.DemoJAWT
  34. The java2d benchmarking demos include a GTK widget to measure the native
  35. speed of some basic java2d options, without the JNI overhead.
  36. You can invoke it with:
  37. make -f Makefile.java2d
  38. Or you can compile by hand as follows:
  39. gcc -g -O0 -Wall -I./gnu/classpath/examples/java2d \
  40. -o cairobench gnu/classpath/examples/java2d/bench.c \
  41. `pkg-config --libs --cflags gtk+-2.0`
  42. You can then run the example as follows:
  43. ./cairobench
  44. All example code is distributed under the GNU General Public License (GPL).
  45. The example icons used in some of the examples come from gnome-icon-theme
  46. version 1.2.3 and are also distributed under the GPL.
  47. All these images are stored in the directory gnu/classpath/examples/icons/.
  48. More free icons can be found in the gnome-icon-theme package:
  49. http://ftp.gnome.org/pub/GNOME/sources/gnome-icon-theme/
  50. GNU Classpath examples are free software; you can redistribute it
  51. and/or modify it under the terms of the GNU General Public License as
  52. published by the Free Software Foundation; either version 2, or (at
  53. your option) any later version.
  54. GNU Classpath examples are distributed in the hope that they will be
  55. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  56. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  57. General Public License for more details.
  58. You should have received a copy of the GNU General Public License
  59. along with GNU Classpath examples; see the file COPYING. If not,
  60. write to the Free Software Foundation, 51 Franklin Street, Fifth Floor,
  61. Boston, MA 02110-1301, USA.