LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Run sample java program on jpcap in linux (https://www.linuxquestions.org/questions/linux-software-2/run-sample-java-program-on-jpcap-in-linux-763907/)

Nadishka 10-23-2009 03:35 AM

Run sample java program on jpcap in linux
 
here is the errors when i tried to run them

[root@localhost sample]# javac SendICMP.java
[root@localhost sample]# java SendICMP
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jdk1.6.0_16/jre/lib/i386/libjpcap.so: /usr/java/jdk1.6.0_16/jre/lib/i386/libjpcap.so: undefined symbol: pcap_sendpacket
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1695)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at jpcap.JpcapCaptor.<clinit>(JpcapCaptor.java:251)
at SendICMP.main(SendICMP.java:11)
[root@localhost sample]#


please reply this. Thank you

lutusp 10-23-2009 04:12 AM

Quote:

Originally Posted by Nadishka (Post 3729559)
here is the errors when i tried to run them

[root@localhost sample]# javac SendICMP.java
[root@localhost sample]# java SendICMP
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jdk1.6.0_16/jre/lib/i386/libjpcap.so: /usr/java/jdk1.6.0_16/jre/lib/i386/libjpcap.so: undefined symbol: pcap_sendpacket
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1695)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at jpcap.JpcapCaptor.<clinit>(JpcapCaptor.java:251)
at SendICMP.main(SendICMP.java:11)
[root@localhost sample]#


please reply this. Thank you

So install the missing libraries:

Code:

# yum install jpcap
# yum install pcap


JohnGraham 10-23-2009 04:16 AM

Quote:

Originally Posted by Nadishka (Post 3729559)
[root@localhost sample]# javac SendICMP.java
[root@localhost sample]# java SendICMP
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jdk1.6.0_16/jre/lib/i386/libjpcap.so: /usr/java/jdk1.6.0_16/jre/lib/i386/libjpcap.so: undefined symbol: pcap_sendpacket
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1695)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at jpcap.JpcapCaptor.<clinit>(JpcapCaptor.java:251)
at SendICMP.main(SendICMP.java:11)

Do you have libpcap installed? See if you have a file named `libpcap.so' - it should be in /usr/lib/. If you don't, you need to use your package manager to install it - I *think* you'll just need the normal library, not the development library.

John G

Nadishka 10-26-2009 02:33 AM

libpcap.so is present in /usr/lib but it still gives the error
it seems me that it cannot find where's libpcap.so is?

Or is there something to do with pcp_sendpacket?

I've already set the variables correctly in /etc/profile as required


please help ..:(

JohnGraham 10-26-2009 08:18 AM

Quote:

Originally Posted by Nadishka (Post 3732587)
libpcap.so is present in /usr/lib but it still gives the error
it seems me that it cannot find where's libpcap.so is?

Which distro are you using? I think one of them doesn't include /usr/lib in the default ld-linux search path.

I don't know if this'll help, but to make sure that's not the problem, you can:

Code:

export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
and then run your program - if that makes the error go away, add /usr/lib to your /etc/ld.so.conf file.

John G

Nadishka 10-29-2009 01:37 AM

[root@localhost sample]# java SendICMP
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jdk1.6.0_16/jre/lib/i386/libjpcap.so: /usr/java/jdk1.6.0_16/jre/lib/i386/libjpcap.so: undefined symbol: pcap_sendpacket
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1695)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at jpcap.JpcapCaptor.<clinit>(JpcapCaptor.java:251)
at SendICMP.main(SendICMP.java:11)

it still gives the error
i added libjpcap.so to
/usr/lib
/usr/java/jdk1.6.0_16/jre/lib/i386/libjpcap.so
/usr/java/packages/lib/ext

error detects LD_LIBRARY_PATH which i set to
/usr/java/jdk1.6.0_16/jre/lib/i386/libjpcap.so

question is it doesn't know about pcp_sendpacket

" undefined symbol: pcap_sendpacket "

since lipcap 0.8.3 version doesn't support send packet option i've downloaded libpcap 0.9.7
and did
./configure
make
make install

but it didn't replace /usr/lib following files

libpcap.a
libpcap.so.0
libpcap.so.0.8
libpcap.so.0.8.3

which is of old libpcap version may be that's why libjpcap.so is giving errors
thanx for your help...
but im still stuck ... :(


All times are GMT -5. The time now is 02:28 AM.