LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-23-2009, 03:35 AM   #1
Nadishka
LQ Newbie
 
Registered: Oct 2009
Posts: 10

Rep: Reputation: 0
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
 
Old 10-23-2009, 04:12 AM   #2
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by Nadishka View Post
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
 
Old 10-23-2009, 04:16 AM   #3
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by Nadishka View Post
[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
 
Old 10-26-2009, 02:33 AM   #4
Nadishka
LQ Newbie
 
Registered: Oct 2009
Posts: 10

Original Poster
Rep: Reputation: 0
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 ..
 
Old 10-26-2009, 08:18 AM   #5
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by Nadishka View Post
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
 
Old 10-29-2009, 01:37 AM   #6
Nadishka
LQ Newbie
 
Registered: Oct 2009
Posts: 10

Original Poster
Rep: Reputation: 0
[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 ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compile and run a java program in linux !!!! jmax24 Programming 7 08-06-2010 03:56 AM
Trying to run a java program vmelkon Ubuntu 6 05-30-2007 06:05 AM
How to run JAR from within Java program ?! EAD Programming 1 12-31-2006 07:11 PM
error when run java program vanhelsing Programming 8 12-24-2004 02:23 AM
how to run linux command from java program? ranger225 Linux - Newbie 1 11-10-2004 06:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration