Guides

1.5.1 - RedHat/Fedora/CentOS

Commands to install development environment on a blank CentOS install:

Executed as root (user "mark" is only used as an example, replace with your own username):

  1. Install Sun java from: http://java.sun.com (default gnu java will not compile JNI)
  2. To redirect just installed java environment use linux "alternatives" sub-system:
    alternatives --install /usr/bin/java java /usr/java/latest/bin/java 2
    alternatives --display java; (optional - verify preference)
    alternatives --config java;  (optional - make sure our java alternative is "best")
    
  3. Define JAVA_HOME variable: setenv JAVA_HOME /usr/java/latest
  4. yum install libpcap-devel
  5. yum install rpmrebuild
  6. yum install gcc-c++
  7. yum install ant (pulls in about 60Mb of other packages)
  8. yum install ant-nodeps (needed for "javah" task)
  9. yum install rpm-build (needed for build-rpm target)
  10. (optional) install junit for running the ant "test" target
    yum install ant-junit
  11. yum install subversion
  12. (optional) Create user if you don't have an account (use your own user name):
    useradd mark
    and assign a password:
    passwd mark
  13. su - mark
  14. Checkout source code (complete details):
    svn co https://jnetpcap.svn.sourceforge.net/svnroot/jnetpcap/jnetpcap/trunk jnetpcap
  15. As root run jUnit testcases to make sure everything compiles correctly. Tests need to be run as root, as some of the tests check interface parameters that require root privilege:
    su
    ant clean test
    #if everything tested OK
    exit
    
  16. from the jnetpcap SVN working directory invoke the "package-rpm" target which will compile the shared library and all the java classes. Output is under "dist/" directory.
    ant -Dos=centos5 clean package-rpm
    
  17. rpm -iv dist/jnetpcap-1.3.b0003-centos5.i386.rpm
  18. ls -l /usr/lib/libjnetcap*
    lrwxrwxrwx 1 root root      33 Jul 4 17:33 /usr/lib/libjnetpcap.so -> /usr/lib/libjnetpcap.so.1.3.b0003
    -rw-r--r-- 1 root root 1193147 Jul 4 17:29 /usr/lib/libjnetpcap.so.1.3.b0003
    
  19. ls -l /usr/share/java/jnetpcap*
    -rw-r--r-- 1 root root 463175 Jul 4 17:29 /usr/share/java/jnetpcap-1.3.b0003.jar
    lrwxrwxrwx 1 root root     38 Jul 4 17:33 /usr/share/java/jnetpcap.jar -> /usr/share/java/jnetpcap-1.3.b0003.jar
    
  20. ls /usr/share/doc/jnetpcap*
    javadoc
    

Other names that should be used with the "-Dos=" argument to ant during build. You can substitute the major OS version number at the end:

  1. fc9 - for FedoraCore OS
  2. CentOS5 - for CentOS

This example assumes that we are taking a snapshot of the latest state of the development trunk (SVN trunk) which is assigned a build number (defined in file build.number in jnetpcap working directory). Build numbers are incremented after each official or internal build by jnetpcap builders.