0

i want to add jpcap.jar the path is this:

C:\WINDOWS\Sun\Java\lib\ext

how to do this?

import java.lang.ClassLoader;

is it needed? or:

  System.loadLibrary('what must be in here?');

or:

System.load(???);

suppose this code:

public void receivePacket(Packet packet) {
System.out.println(packet);
if (packet instanceof IPPacket) {
IPPacket ipp = (IPPacket)packet;
InetAddress dest = ipp.dst_ip;
InetAddress src = ipp.src_ip;
System.out.print(src);
System.out.print(dest);
 }

in the main i have this:

s.receivePacket(Packet.EOF);

but it returns:

0.0

i added library with rightclick add library but i think it doesn't work cause: i have this when selecting packet

Javadoc not found. Either Javadoc documentation for this item does not exist or you have not added specified Javadoc in the Java Platform Manager or the Library Manager

Nickool
  • 3,662
  • 10
  • 42
  • 72

2 Answers2

1

Here you will find the answer on how to add jcap.jar: how-to-add-library-files-in-netbeans.

The absence of javadoc doesn't mean that you haven't added the library itself, because javadocs are usually in separate jars or zips.

If the code that uses library method is compiled, than the problem is not in the absence of library.

Usually, the source code of any java library, the binary files and javadoc are contained in separate jar-files, zip-files or folders.

UPDATE: The soulution is:

  1. download jpcap-x.x.zip from here;
  2. unzip it to any folder you like;
  3. add the doc/javadoc subfolder of unzipped folder to your library in library manager.

Video How-To.

Community
  • 1
  • 1
MockerTim
  • 2,475
  • 1
  • 25
  • 31
  • I did it and I studied it previously but no result in this code – Nickool Jun 06 '11 at 18:52
  • @Negin I've updated my answer a bit. Do you have any errors while compiling your project? – MockerTim Jun 06 '11 at 19:01
  • no not error it is build success full showing me 0.0 but it has Javadoc not found. Either Javadoc documentation for this item does not exist or you have not added specified Javadoc in the Java Platform Manager or the Library Manager when selecting IPPACKET or Packet.etc – Nickool Jun 06 '11 at 19:10
  • but then why it tells me that in explanation of IPPACKET?! – Nickool Jun 06 '11 at 19:12
  • @Negin Do you know the location of javadoc for jpcap.jar? You should specify the path to library javadoc in library manager. – MockerTim Jun 06 '11 at 19:13
  • can you give me the differences between javadoc and classes and source in java platforms and then what is library i am confused here – Nickool Jun 06 '11 at 19:16
  • @Negin Ok. Then we need more information. Can you tell us where did you get that jpcap.jar. Where can I get it? – MockerTim Jun 06 '11 at 19:21
  • Mocker I got it from my friend but i can send the file to you if you want or if you have another choice for me please tell me i will use it – Nickool Jun 06 '11 at 19:23
  • @Negin Does [this resource](http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) describes your library? Maybe you can get it there? – MockerTim Jun 06 '11 at 19:29
  • yes i think i have these in the java folder of c:/programfiles==>jre1.6.0_03 and jre6 they are folders and in c:/windows/etc i have jpcap.jar – Nickool Jun 06 '11 at 19:39
  • @Negin I've installed this library. The problem is that it doesn't install any javadoc on local machine. Shit happens... So you'll need to use the [online javadoc](http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/javadoc/index.html). – MockerTim Jun 06 '11 at 19:45
  • Mocker how!? in this site i must try what? – Nickool Jun 06 '11 at 19:51
  • I used librarymanager as u told but no result similer to previous – Nickool Jun 06 '11 at 20:08
  • I added C:\programfiles\java\jpcap-0-6 – Nickool Jun 06 '11 at 20:09
  • i used to go to tools=>javaplatforms not libreries but since u told i used tools=>libraries – Nickool Jun 06 '11 at 20:10
  • leave it Mocket I appreciate your help:) you tried hard for me it is my fault I'm accepting your answer – Nickool Jun 06 '11 at 20:12
  • @Negin Please add to your question a scrinshot of your library configuration window's 'Javadoc' tab. – MockerTim Jun 06 '11 at 20:12
  • Have you solved it? I can help you via ICQ or e-mail if it's still unsolved. – MockerTim Jun 06 '11 at 20:14
  • how i must insert image here? i don't know please tell me – Nickool Jun 06 '11 at 20:16
  • nickparsa@gmail.com do you have gmail? – Nickool Jun 06 '11 at 20:17
0

Nice to see that your problem is solved after a lot of struggle. Have a look at which4j project. It can help solve these issues quickly

kiran.kumar M
  • 811
  • 8
  • 25
  • which4j can be used to print the name of the jar for a given class. It will search in the classpath. http://javafanatics.blogspot.com/2007/04/which4j.html – kiran.kumar M Jun 10 '11 at 06:28