Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JNI using Tomcat 5.5 under Mac OS X 10.4.9 on an intel mac.

Posted on 2007-03-20
6
Medium Priority
?
1,067 Views
Last Modified: 2013-11-23
Does anybody have experience with JNI with tomcat under mac os (intel)? Probably not... :-) Anyway, I thought I'd give it a shot here...

I'm doing some web-development and just switched to a macbook pro from pc.  I've installed tomcat 5.5, and eclipse 3.2. The web application I'm building is using a native library written in c++, the library is compiled into a universal binary (libMyWrapper.jnilib) and works with a stand-alone java application on the same machine. When trying to load the library from tomcat i get an unsatisfied link error: java.lang.UnsatisfiedLinkError: no MyWrapper in java.library.path. So i printed the java.library.path to the console and put the required jnilib on all those places but it still didn't work. I've also tried to load the library using System.load() and the absolute path to the jnilib without result.

I hope anyone out there can help me!
0
Comment
Question by:kveasana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 18757210
>> So i printed the java.library.path to the console and put the required jnilib on all those places but it still didn't work.

Did you restart Tomcat after that? You need to....
0
 

Author Comment

by:kveasana
ID: 18762462
Yes, I even restarted the machine...
0
 

Author Comment

by:kveasana
ID: 18762697
It's working! Well kinda... I moved the jnilib to /usr/lib and loaded it with an absolute path using System.load("/usr/lib/libMyWrapper.jnilib");. (this only works if the jnilib is in /usr/lib and nowhere else)

The jnilib is dependent on a few other libraries, using otool i get the following output:

libMyWrapper.jnilib:
        libMyWrapper.jnilib (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
        libxerces-c.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.4)

Even if I copy all these libraries to the java.class.path it doesn't work, could it be because of "recursive" dependency, i.e. the libSystem.B.dylib is dependent on a library outside the java.class.path?

On the other hand I added /usr/lib to the java.class.path and still it wouldn't load...

Any ideas?

0
 
LVL 30

Accepted Solution

by:
Mayank S earned 2000 total points
ID: 18768876
You don't need to add it to java.class.path - you need to add it to java.library.path
0

Featured Post

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question