README
1This directory contains example programs that show how the GNU Classpath
2library can be used.
3
4Each example has its own package under gnu.classpath.examples and has a
5class Demo which contains a main() method to run that particular example.
6
7The examples can be compiled and run with gcj as follows:
8
9 gcj -o swingdemo --main=gnu.classpath.examples.swing.Demo \
10 gnu/classpath/examples/swing/Demo.java \
11 gnu/classpath/examples/swing/GNULookAndFeel.java
12 ./swingdemo
13
14Or with a traditional byte code interpreter like:
15
16 gcj -C gnu/classpath/examples/awt/Demo.java
17 gij gnu.classpath.examples.awt.Demo
18
19The installation also comes with an examples.zip archive that contains
20all needed resources and compiled byte code class files that can be
21run as follows:
22
23 kaffe -classpath examples.zip gnu.classpath.examples.awt.Demo
24 kaffe -classpath examples.zip gnu.classpath.examples.swing.Demo
25
26The jawt Demo needs some extra support library that currently needs to be
27build 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.
30
31You can invoke it with:
32
33 make -f Makefile.jawt
34
35Or you can compile by hand as follows:
36
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
43
44You can then run the example as follows:
45
46 export LD_LIBRARY_PATH=.:/usr/local/classpath/lib/classpath
47 jamvm gnu.classpath.examples.jawt.DemoJAWT
48
49The java2d benchmarking demos include a GTK widget to measure the native
50speed of some basic java2d options, without the JNI overhead.
51
52You can invoke it with:
53
54 make -f Makefile.java2d
55
56Or you can compile by hand as follows:
57
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`
61
62You can then run the example as follows:
63
64 ./cairobench
65
66All example code is distributed under the GNU General Public License (GPL).
67
68The example icons used in some of the examples come from gnome-icon-theme
69version 1.2.3 and are also distributed under the GPL.
70All these images are stored in the directory gnu/classpath/examples/icons/.
71
72More free icons can be found in the gnome-icon-theme package:
73http://ftp.gnome.org/pub/GNOME/sources/gnome-icon-theme/
74
75
76GNU Classpath examples are free software; you can redistribute it
77and/or modify it under the terms of the GNU General Public License as
78published by the Free Software Foundation; either version 2, or (at
79your option) any later version.
80
81GNU Classpath examples are distributed in the hope that they will be
82useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
83MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
84General Public License for more details.
85
86You should have received a copy of the GNU General Public License
87along with GNU Classpath examples; see the file COPYING. If not,
88write to the Free Software Foundation, 51 Franklin Street, Fifth Floor,
89Boston, MA 02110-1301, USA.
90