Xcode -> Java Native Interface -> Eclipse
Xcode -> Java Native Interface -> Eclipse
- Subject: Xcode -> Java Native Interface -> Eclipse
- From: Matthew Grivich <email@hidden>
- Date: Wed, 14 May 2008 13:43:20 -0700
Hello All,
I am attempting to write a frame grabber and camera control program
for Macintosh. The frame grabber in question uses a C api. I have
written a simple java wrapper for this using the java native interface
(JNI), entirely in Xcode. However, Xcode does not have very good Java
support, so I'd like to write the Java portions of the program in
Eclipse, and the C and java native interface portions in Xcode. I am
using Xcode 3.0, OS 10.5.2, a dual processor G5, and Eclipse 3.3.2.
First, I will say what works. In Xcode: File -> New Project -> Java ->
Java JNI Application. Makes jni version of hello world, works fine. I
copy the generated headers folder and the .jnilib to a jnilib folder in
my eclipse project (EclipseTest/jnilib). In eclipse: Right click
project name (EclipseTest) -> properties -> source -> EclipseTest/src ->
Set Native library location to EclipseTest/jnilib. I copy the .java
file from the Xcode project to the Eclipse Project src folder, by
creating a new java file in Eclipse, and copy-pasting the text of the
file from Xcode. Everything works.
In Xcode: I start with the jni hello world. I add the C files from the
third party api. I write the appropriate wrapper code to do some simple
operations with the camera (open, snap, and close) from java. In order
to get things to link properly, I add a build phase to the JNILib
target. This build phase is Link Binary With Libraries. Right click
this, then Add -> Existing Frameworks -> select the five necessary third
party frameworks. These frameworks are located in /Library/Frameworks.
This all works.
Now, I will get to what doesn't work. I transfer camera .jnilib and
headers folder over to an eclipse project. When I try to run it, I get
Started application
Exception in thread "main" java.lang.UnsatisfiedLinkError: OpenCamera
at edu.salk.snl.micrimap.Grabber.OpenCamera(Native Method)
at edu.salk.snl.micrimap.Grabber.main(Grabber.java:80)
When I don't make the jnilib available, it gives
Exception in thread "main" java.lang.UnsatisfiedLinkError: no Grabber in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1753)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:993)
at edu.salk.snl.micrimap.Grabber.<clinit>(Grabber.java:25)
So I know that it is finding the .jnilib.
My belief is that it is not finding the third party frameworks and that
they are not included in the .jnilib. However, I have not found the
"make it work" button. Any assistance
would be much appreciated.
Thanks.
Matthew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden