From 6fa9e5dac7c2381fc91c87152dc15c49ba38d377 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 8 Mar 2014 12:29:00 +0000 Subject: [PATCH] java: Document how to compile and run Java programs. --- java/examples/guestfs-java.pod | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/java/examples/guestfs-java.pod b/java/examples/guestfs-java.pod index cae70eae6..10deebec2 100644 --- a/java/examples/guestfs-java.pod +++ b/java/examples/guestfs-java.pod @@ -107,6 +107,46 @@ parameters: For more information, see L. +=head1 COMPILING AND RUNNING + +Libguestfs for Java is a Java Native Interface (JNI) extension, +supplied in three parts: + +=over 4 + +=item C + +=item C.jar> + +The pure Java JAR file which contains several classes, the primary one +being C. Upstream, the JAR file +contains a version number in the filename, but some Linux distros may +rename it without the version number. + +=item C + +The JNI code (written in C). This contains private native functions +that interface between Java code and the regular libguestfs C library. +You should B call these directly. + +=item C + +The regular libguestfs C library. + +=back + +To compile your Java program, you need to locate the JAR file and add +it to the class path. For example: + + export CLASSPATH=/usr/share/java/libguestfs.jar + javac MyProgram.java + +To run your Java program, you also need to ensure that the JAR file is +on the class path, as well as the path of your program. For example: + + export CLASSPATH=.:/usr/share/java/libguestfs.jar + java MyProgram + =head1 EXAMPLE 1: CREATE A DISK IMAGE @EXAMPLE1@