LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-24-2006, 08:59 AM   #1
ilough
LQ Newbie
 
Registered: Feb 2006
Posts: 3

Rep: Reputation: 0
creating .so for JNI app on redhat 4


Problem with jni / lib.so creation on RedHat 64

--------------------------------------------------------------------------------

In an attempt to port my real-world app from AIX to Linux, i have digressed into trying
to get a "helloworld" jni program running. My problem is the creation of the .so. When the java program runs, i get the standard:

"Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/ill/test2/libctree.so:
/usr/ill/test2/libctree.so: cannot open shared object file: No such file or directory"

I realize it actually finds the file, but has an issue with it. my compile/link for
the .so looked like this orginally:
javac HelloWorld.java
javah -jni HelloWorld
gcc -shared -fpic -I/APP/java/j2sdk1.4.2_10/include ctree.c -o libctree.so

My LD_LIBRARY_PATH is:
/usr/ill/test2:/usr/lib:/lib64:/lib64/tls:/home/infauser/esreporting/extraction_toolkit:/opt/IBM/db2/V8.1/lib:/opt/informatica/repositoryserver:/opt/informatica/server:.:/files/esrdbo/sqllib/lib

When i do a ldd <.soname> i get:
libc.so.6 => /lib64/tls/libc.so.6 (0x0000002a95659000)
/lib64/ld-linux-x86-64.so.2 (0x000000552aaaa000)

What else am i missing: i am using java 1.4.2_10 (32 bit) on redhat version 4 (64 bit) on
an ibm xseries

Insight much appreciated!!!
 
Old 02-24-2006, 01:58 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Have you tried compiling your shared library as a 32-bit ELF
(making it more likely that your 32-bit Java runtime can load it)?

At a minimum, you'll need to:
a) Build your .so with the gcc "-m32" switch
b) Make sure you have a 32-bit C runtime installed
c) Adjust your LD_LIBRARY_PATH accordingly

You might also consider downloading a more recent (e.g. Java 5.0)
JRE - one that might be likelier to be 64-bit aware.

'Hope that helps .. PSM
 
  


Reply



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
Problem with jni / lib.so creation on RedHat 64 ilough Linux - Software 0 02-24-2006 08:46 AM
print problem with Java and C JNI trutnev Programming 0 06-20-2005 11:28 AM
JNI / jawt bobwall Programming 0 09-12-2004 10:35 AM
Regarding interfacing of C with JAVA thru JNI nedian123 Programming 3 07-28-2004 02:39 PM
What is a good app builder for creating portals? lostboy Programming 1 09-13-2003 09:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:57 AM.

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