I'm using Jnetpcap 1.3.0 version for extracting the pcap file.
Below is my code snippet
/* Main Class */
public class Proceed{
public static void main(String[] args) {
PCapFile pcapFile = new PCapFile("C:/test/no-gre-sample.pcap");
pcapFile.process();
}
}
/in some other class I have written this method */
public void process() {
RandomAccessFile raf = null;
FileLock lock = null;
try {
raf = new RandomAccessFile(file, "rw");
lock = raf.getChannel().tryLock();
this.pcap = Pcap.openOffline(file, errbuf);
System.out.printf("Opening file for reading: %s", filePath);
if (pcap == null) {
System.err.println(errbuf); // prob occurs here
} else {
PcapPacketHandler<String> jpacketHandler;
jpacketHandler = new PcapPacketHandler<String>() {
@Override
public void nextPacket( packet, String user) {
PPacket pcap = new PPacket(packet, user);
//Process packet
}
};
// Loop over all packets in the file...
try {
pcap.loop(-1, jpacketHandler, "jNetPcap Rocks!!!!!");
} finally {
pcap.close();
}
}
} catch (IOException e) {
System.err.println(e.getMessage());
} finally {
try {
if (lock != null) {
lock.release();
}
if (raf != null) {
raf.close();
}
} catch (IOException e) {
System.err.println(e.getMessage());
}
}
}
But while running on eclipse(Windows) I'm getting this error
"error reading dump file: Permission denied"
I have included the .dll file as well , but cant seem to understand what is the issue here.
Note - (This code works fine on Ubuntu)