Products and Services Support Training Documentation Partner Programs About Red
Hat
  download storecart
red hat logo
redhat.comredhat network

Red Hat Documentation

CCVS Administration Guide: Java Installation

CCVS Administrator's Guide
Building the CCVS Java Interface

Version 3.3


Revised February 15, 2025

Red Hat, Inc.
2600 Meridian Pkwy
Durham, NC 27713
919-547-0012



Back to main Documentation page
Back to Administrator's Guide
 

Table of Contents

Overview
Finding the Source Code
Building the JAR File
Building the JNI Module
Using CCVS in Java
 

Overview

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:

mkdir /usr/local/ccvs/lib/java
ln -s /usr/local/ccvs/lib/java /usr/local/ccvs/class
cp ccvs.jar /usr/local/ccvs/class

Building the JNI Module

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:

gcc -shared -Wl,-soname,libccvsjni.so -I/usr/local/ccvs/include ccvsjni.c -o libccvsjni.so -L/usr/local/ccvs/lib -lccvs -lc

If the Java header files are not in the default system path on your system, you may need to include those as well.

The last step is to install libccvsjni.so so that it can be used. Just copy it into the directory that the JAR file is in.

At this point, the documentation in our CCVS Programmer's Guide for Java should be sufficient.

Using CCVS in Java

See the Java Language API.
  <.php3>

 

 


 
© 2001 Red Hat, Inc. All rights reserved.
About Red Hat  :  Legal statement  :  Privacy statement  :  Y2K statement  :  Contact Red Hat