1 |
781 |
jeremybenn |
This directory contains example programs that show how the GNU Classpath
|
2 |
|
|
library can be used.
|
3 |
|
|
|
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.
|
6 |
|
|
|
7 |
|
|
The 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 |
|
|
|
14 |
|
|
Or 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 |
|
|
|
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
|
21 |
|
|
run as follows:
|
22 |
|
|
|
23 |
|
|
kaffe -classpath examples.zip gnu.classpath.examples.awt.Demo
|
24 |
|
|
kaffe -classpath examples.zip gnu.classpath.examples.swing.Demo
|
25 |
|
|
|
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.
|
30 |
|
|
|
31 |
|
|
You can invoke it with:
|
32 |
|
|
|
33 |
|
|
make -f Makefile.jawt
|
34 |
|
|
|
35 |
|
|
Or 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 |
|
|
|
44 |
|
|
You 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 |
|
|
|
49 |
|
|
The java2d benchmarking demos include a GTK widget to measure the native
|
50 |
|
|
speed of some basic java2d options, without the JNI overhead.
|
51 |
|
|
|
52 |
|
|
You can invoke it with:
|
53 |
|
|
|
54 |
|
|
make -f Makefile.java2d
|
55 |
|
|
|
56 |
|
|
Or 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 |
|
|
|
62 |
|
|
You can then run the example as follows:
|
63 |
|
|
|
64 |
|
|
./cairobench
|
65 |
|
|
|
66 |
|
|
All example code is distributed under the GNU General Public License (GPL).
|
67 |
|
|
|
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/.
|
71 |
|
|
|
72 |
|
|
More free icons can be found in the gnome-icon-theme package:
|
73 |
|
|
http://ftp.gnome.org/pub/GNOME/sources/gnome-icon-theme/
|
74 |
|
|
|
75 |
|
|
|
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.
|
80 |
|
|
|
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.
|
85 |
|
|
|
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.
|