Adam Doupé

Assistant Professor, Arizona State University

Compiling Jpcap on 64-bit Ubuntu 10.10

| Comments

Why?

While learning more about clojure, I wanted to do some network sniffing. Following a guide to raw traffic in clojure I needed to install jpcap in order to use libpcap from java.

Jpcap doesn’t provide a 64-bit version so I had to compile my own. Here’s the documentation of how I did it. A patch is provided at the end of the post.

Compiling jpcap 0.7 on 64-bit Ubuntu 10.10

  1. First install sun java on ubuntu 10.10
  1. Download jpcap or use the following command:

      wget http://netresearch.ics.uci.edu/kfujii/Jpcap/jpcap-0.7.tar.gz
    
  2. Untar jpcap

     tar -xvf jpcap-0.7.tar.gz
    
  3. Move into src directory

     cd jpcap-0.7/src/c/
    
  4. Open up Makefile in your favorite editor (mine’s emacs)

     emacs Makefile
    
  5. Change this line:

     JAVA_DIR = $(JAVA_HOME)
    

    To This:

     JAVA_DIR = /usr/lib/jvm/java-6-sun/
    
  6. Change the compile options from this:

     COMPILE_OPTION = -shared -L.
    

    To this:

     COMPILE_OPTION = -shared -L. -fPIC
    
  7. Save your file and close your editor.

  8. Run make:

      make
    
  9. Follow the jpcap installation instructions

Patch for more advanced users

Patch to do this automatically

How to patch

Let me know if you have any problems!

Comments