The Java interface to CCVS must sometimes be built after the rest of CCVS
is installed. This is the case, for example, when you're using an OS
distribution that doesn't come with a version of JDK -- if we can't make
sure we're using the same version of the JDK that you are, it's not really
safe for us to distribute a pre-built version of our Java interface for
you.
Finding the Source Code
The source code for our Java interface is in src/other under the
directory in which you installed CCVS. So, if you used the default
location, it would be /usr/local/ccvs/src/other. The files
in question are all of the .java files, plus "ccvsjni.c".
Building the JAR File
The first step of building the Java interface is to build the JAR file.
The JAR file contains all the class files of the Java interface, so we
need to build all the class files.
These classes will ultimately be named net.hks.Ccvs and net.hks.CcvsException,
so you need to set up the package directory structure. The easiest way to do
this is to execute the following (in the source directory):
ln -s . net
ln -s . hks
You should then make sure that your CLASSPATH environment variable
includes the current directory. (This is only necessary to compile the source.
You will later move the JAR file to a more permanent location.)
If your shell is csh (or tcsh, etc) then type:
setenv CLASSPATH ${cwd}:${CLASSPATH}
Under sh (or bash, etc) use:
CLASSPATH=${PWD}:${CLASSPATH}; export CLASSPATH
(If you see an error like "CLASSPATH: Undefined variable" then you have
no current CLASSPATH. Substitute one of the commands
setenv CLASSPATH ${cwd}
CLASSPATH=${PWD}; export CLASSPATH
respectively.)
Once the CLASSPATH is set,
you need to run your java compiler on each of the class source files.
If you're using Sun's JDK, the Java compiler is named "javac". So,
you would do the following:
javac Ccvs.java
javac CcvsException.java
After this, we can build the JAR file. If you're using Sun's JDK,
you build a JAR file from class files using the "jar" command, like this:
jar cf ccvs.jar net/hks/Ccvs.class net/hks/CcvsException.class
Once you've got this built, you need to install it into the location where
you'll use it. If you want to use the default location for CCVS,
do the following:
The next step is to build the JNI module. First, we need to build
the header file from the Java class file. Using Sun's JDK, we would
use the "javah" command to do this, like this:
javah net.hks.Ccvs
Next, we must build the shared library. Using gcc on a typical Linux
system, with CCVS installed in the default location, here's how we might
do that: