By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,032 Members | 825 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,032 IT Pros & Developers. It's quick & easy.

packet capturing

P: 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
Share this Question
Share on Google+
1 Reply


10K+
P: 13,264
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

Post your reply

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