473,322 Members | 1,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

packet capturing

1
hi
Please help me.i am developing a java pgm to capture network packets using jpcap.i downloded jpcap and wpcap dll files.
My pgm is:

Expand|Select|Wrap|Line Numbers
  1. import jpcap.JpcapHandler;
  2. import jpcap.Jpcap;
  3. import jpcap.Packet;
  4. public class sample implements JpcapHandler {
  5. public void handlePacket(Packet packet){
  6. System.out.println(packet);
  7. }
  8. public static void main(String[] args) throws java.io.IOException{
  9. String[] devices = Jpcap.getDeviceList();
  10. for (int i = 0; i < devices.length; i++) {
  11. System.out.println(devices);
  12. }
  13. String deviceName = devices[0];
  14. Jpcap jpcap = Jpcap.openDevice(deviceName, 1028, false, 1);
  15. jpcap.loopPacket(-1, new sample());
  16. }
  17. }
  18. when i run this pgm i got the following errors.
  19.  
  20. C:\Program Files\Java\jre1.5.0\bin>javac sample.java
  21. sample.java:1: cannot find symbol
  22. symbol : class JpcapHandler
  23. location: package jpcap
  24. import jpcap.JpcapHandler;
  25. ^
  26. sample.java:2: cannot find symbol
  27. symbol : class Jpcap
  28. location: package jpcap
  29. import jpcap.Jpcap;
  30. ^
  31. sample.java:3: cannot find symbol
  32. symbol : class Packet
  33. location: package jpcap
  34. import jpcap.Packet;
  35. ^
  36. sample.java:5: cannot find symbol
  37. symbol: class JpcapHandler
  38. public class sample implements JpcapHandler {
  39. ^
  40. sample.java:6: cannot find symbol
  41. symbol : class Packet
  42. location: class sample
  43. public void handlePacket(Packet packet){
  44. ^
  45. sample.java:11: cannot find symbol
  46. symbol : variable Jpcap
  47. location: class sample
  48. String[] devices = Jpcap.getDeviceList();
  49. ^
  50. sample.java:19: cannot find symbol
  51. symbol : class Jpcap
  52. location: class sample
  53. Jpcap jpcap = Jpcap.openDevice(deviceName, 1028, false, 1);
  54. ^
  55. sample.java:19: cannot find symbol
  56. symbol : variable Jpcap
  57. location: class sample
  58. Jpcap jpcap = Jpcap.openDevice(deviceName, 1028, false, 1);
  59. ^
Help me please. Whats the problem in this code and tell me how to set classpath.
Jan 7 '07 #1
1 6459
r035198x
13,262 8TB
hi
Please help me.i am developing a java pgm to capture network packets using jpcap.i downloded jpcap and wpcap dll files.
My pgm is:

import jpcap.JpcapHandler;
import jpcap.Jpcap;
import jpcap.Packet;
public class sample implements JpcapHandler {
public void handlePacket(Packet packet){
System.out.println(packet);
}
public static void main(String[] args) throws java.io.IOException{
String[] devices = Jpcap.getDeviceList();
for (int i = 0; i < devices.length; i++) {
System.out.println(devices);
}
String deviceName = devices[0];
Jpcap jpcap = Jpcap.openDevice(deviceName, 1028, false, 1);
jpcap.loopPacket(-1, new sample());
}
}
when i run this pgm i got the following errors.

C:\Program Files\Java\jre1.5.0\bin>javac sample.java
sample.java:1: cannot find symbol
symbol : class JpcapHandler
location: package jpcap
import jpcap.JpcapHandler;
^
sample.java:2: cannot find symbol
symbol : class Jpcap
location: package jpcap
import jpcap.Jpcap;
^
sample.java:3: cannot find symbol
symbol : class Packet
location: package jpcap
import jpcap.Packet;
^
sample.java:5: cannot find symbol
symbol: class JpcapHandler
public class sample implements JpcapHandler {
^
sample.java:6: cannot find symbol
symbol : class Packet
location: class sample
public void handlePacket(Packet packet){
^
sample.java:11: cannot find symbol
symbol : variable Jpcap
location: class sample
String[] devices = Jpcap.getDeviceList();
^
sample.java:19: cannot find symbol
symbol : class Jpcap
location: class sample
Jpcap jpcap = Jpcap.openDevice(deviceName, 1028, false, 1);
^
sample.java:19: cannot find symbol
symbol : variable Jpcap
location: class sample
Jpcap jpcap = Jpcap.openDevice(deviceName, 1028, false, 1);
^

Help me please. Whats the problem in this code and tell me how to set classpath.
Have a look at

http://mindprod.com/jgloss/classpath.html
Jan 8 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Brandon Potter | last post by:
Looking for a good packet capture library in .NET capable of capturing packets (whether natively or through third party/WinPCap, etc.). Or, at least, a library capable of decoding packet...
3
by: Simon | last post by:
Hi everyone, I'd quite like to create a small application that could listen on a port and take a copy of any communications going in or out. The end goal is to be able to offer statistics and...
0
by: Nuno Magalhaes | last post by:
Why does C# only supports LAN packet sniffing? Should I have to use WinPCap if I want to capture the outgoing packets on xp pro also? Why this limitation? Here's the source for capturing the...
5
by: pmm | last post by:
hi I am a beginner in network programming I am trying out a UDP packet transfer between a windows machine and a linux I created a structure on both sides (ie on linux and on windows) and I sent...
2
by: Ushach | last post by:
hi, how to capture a TCP packet in java?which package I have to use?
3
by: nexus024 | last post by:
I am trying to write a program that will continuously sniff eth0 for a specific UDP packet thats being sent to a specific destination IP, alter the data of the packet, and finally transmit it to the...
1
by: sangith | last post by:
Hi, I tried the packet capture module program. I did a file transfer using ftp from this host to another server. But when I ran the program, it was just hanging off and it did not print the...
3
by: T00l | last post by:
Hi All I have found the simple script that sniffs ICMP packets using Impacket and pcapy. At the moment it is capturing the packet header and data, I was just wondering if anyone knows a way to get...
10
by: stars14u | last post by:
i have written a code for packet capturing in "C". now i need to save the packets and extract its payload from the packets. once extracted i do some changes to the payload and reform the packet...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.