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
Download jpcap or use the following command:
wget http://netresearch.ics.uci.edu/kfujii/Jpcap/jpcap-0.7.tar.gz
Untar jpcap
tar -xvf jpcap-0.7.tar.gz
Move into src directory
cd jpcap-0.7/src/c/
Open up Makefile in your favorite editor (mine’s emacs)
emacs Makefile
Change this line:
JAVA_DIR = $(JAVA_HOME)
To This:
JAVA_DIR = /usr/lib/jvm/java-6-sun/
Change the compile options from this:
COMPILE_OPTION = -shared -L.
To this:
COMPILE_OPTION = -shared -L. -fPIC
Save your file and close your editor.
Run make:
make
Follow the jpcap installation instructions
Patch for more advanced users
Patch to do this automatically
Let me know if you have any problems!