mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
java: Document how to compile and run Java programs.
This commit is contained in:
@@ -107,6 +107,46 @@ parameters:
|
||||
|
||||
For more information, see L<guestfs(3)/guestfs_create_flags>.
|
||||
|
||||
=head1 COMPILING AND RUNNING
|
||||
|
||||
Libguestfs for Java is a Java Native Interface (JNI) extension,
|
||||
supplied in three parts:
|
||||
|
||||
=over 4
|
||||
|
||||
=item C<libguestfs.jar>
|
||||
|
||||
=item C<libguestfs-I<VERSION>.jar>
|
||||
|
||||
The pure Java JAR file which contains several classes, the primary one
|
||||
being C<com.redhat.et.libguestfs.GuestFS>. Upstream, the JAR file
|
||||
contains a version number in the filename, but some Linux distros may
|
||||
rename it without the version number.
|
||||
|
||||
=item C<libguestfs_jni.so>
|
||||
|
||||
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<not> call these directly.
|
||||
|
||||
=item C<libguestfs.so>
|
||||
|
||||
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@
|
||||
|
||||
Reference in New Issue
Block a user