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