July 2014

Load without java.awt.Image References

I am working on applying jnetpcap to an existing application that uses jPCAP. jnetpcap provides a more robust and intuitively obvious interface and, very importantly, is supported. I am currently running it against the Oracle Java 7 SE Embedded for Linux (headless) and it runs fine. However, I tried to run it against the compact3 version of Java 8 SE Embedded for Linux (also headless) and it fails with JRegistry trying to parse a built-in protocol (probably HTTP) due to no java.awt.Image class available. The reason for wanting to go to Java 8 is due to the size reduction from 31 meg to 21 meg for the runtime (could be smaller but I need some features in the compact3 profile).

Is there a way to prevent JRegistry from trying to load HTTP (or whichever protocol is using the java.awt classes)? If not, how would I go about reducing the included classes so the classes using the java.awt classes are not loaded?

Thank you for a great product. I like the reduced footprint (both memory and CPU) of jnetpcap and the ability to logically define a protocol using annotations (the protocol I am decoding is in UDP packets and is complex with many subheaders and can include an encapsulated Ethernet packet which I also have working). I am decoding for database functionality so no GUI is involved or desired.

Thanks in advance.


jNetPcap on ARM7 (BeagleBone Black Rev C)

I wanted to get jNetPcap working on a BeagleBone Black Rev C (BBB), which runs Debian 7 with an ARM7 processor. I did some google searching, and did not find much on this topic. Therefore, I decided to compile jNetPcap. I figured I would share what I did so that someone else does not have the same headaches I went through. Attached is the .deb installation file, and the MD5 hash file. I put a txt extension on each of the files, since it would not let me upload a .deb file. Simply remove the .txt on the end, and use the following command on the BBB to install it (once you have copied over the file).

dpkg -i jnetpcap-1.4.r1425-1.debian7.arm_.deb

I have tested it and it works. However, I have not done a ton with it yet. I hope this helps someone.

PS - You have to be logged in to download the attachments.

Windows 8.1


There is any incompatibility with Windows 8.1?

I'm trying run the program, but it doesn't work!

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.slytechs.library.NativeLibrary.dlopen(Ljava/lang/String;)J
at com.slytechs.library.NativeLibrary.dlopen(Native Method)
at com.slytechs.library.NativeLibrary.(Unknown Source)
at com.slytechs.library.JNILibrary.(Unknown Source)
at com.slytechs.library.JNILibrary.loadLibrary(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at org.jnetpcap.Pcap.(Unknown Source)
at PacketSniffer.ClassicPcapExample.main(ClassicPcapExample.java:47)

I have done some steps to fix the exceptions:
Downgrade to jNetPcap 1.4 (jnetpcap-1.4.r1425-1.win64) to use stable version.
Use Import>File System to import the jar files into your plug-in project, say in the
/lib directory.
Use "New..." to add "." library back (with no quotes, of course). Some versions of eclipse automatically do this for you.

http.fieldvalue(Http.Response.RequestUrl) returns null

Hey mark i modified your source code ON READING IMAGES FROM HTTP,cause this time i wanted to extract the images urls,but the output is null.
public void processHttp(Http http) {
if (http.getMessageType() != Http.MessageType.RESPONSE) {

JPacket packet = http.getPacket(); // Packet this http belongs to
final long frame = packet.getFrameNumber();
final String cmd = http.fieldValue(Request.RequestMethod);
final String code = http.fieldValue(Response.ResponseCode);
final String ct = http.fieldValue(Response.Content_Type);
String cl = http.fieldValue(Response.Content_Length);
final int payload = http.getPayloadLength();

if ((code != null && code.equals("200") == false)) {
return; // Skip error messages

if (cl == null) {
cl = Integer.toString(payload);

* Responses always have a content type, since we are looking for
* specific content that has been predefined, we can use enum constants.
* We're not interested in anything else, otherwise we'd have to use
* http.contentType() method which returns a string.
ContentType type = http.contentTypeEnum();

switch (type) {
case GIF:
case PNG:
case JPEG:
String RequestUrl=http.fieldValue(Http.Response.RequestUrl);

where could the problem be?

jNetPcap Mac OS X

Hi all,

I have been reading that jNetPcap would provide support for OS X in various posts, and that even a preliminary patch was developed.
Our intended use is to simply read pcap files using Java (offline reading). As far as I understood there should not be a big problem to use it in that mode.

Is there any official or unofficial guide/tutorial/instructions to install jNetPcap in OS X?

Some of the posts I mentioned:

Thanks in advance!