Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glitchy sample code (JNI)



I have sample code from Apple that I cannot get to work. It's on how to use JNI:
http://developer.apple.com/samplecode/JNISample/JNISample.html

I open JNISample.pbproj with XCode and hit Build&Go. It does a lot of stuff
but fails with 10 errors. The first one is
error: JNISample.h: No such file or directory

By hand, I ran javac and javah and put the resulting .h file in the top directory. 
After that, XCode completed the build without more trouble. 
However, the Run log shows this error:
[JavaAppLauncher Error] CallStaticVoidMethod() threw an exception
Exception in thread "main" java.lang.UnsupportedClassVersionError: JNISample (Unsupported major.minor version 49.0)

I believe this means a Java1.4.2 JVM is trying to run code from javac 1.5, but 
I'm overwhelmed by XCode's (steep!) learning curve and don't see how to coax 
it to use the right version.  (My default java tools are 1.5 so I wouldda thought that 
XCode would be using that everywhere. Not so?)

I have tried using xcodebuild from the command line and also just running the 
makefile, but none of these methods will get me an app that works. What is 
exasperating is that there is a completed JNISample.app in the original 
download that *does* work. So tantalizing and yet so far!

How is it that the old app runs while the new ones don't?
Please tell me how to get the sample code to make something that works.
tah,
sj

ps:
Trying to open JNISample.pbproj in ProjectBuilder generates first a prompt about 
updating an old file format and then a fatal error:
Couldn't open JNISampleDir/JNISample.pbproj.
Reason: *** -[PBXToolbar _notificationPostingEnabled]: selector not recognized [self = 0x52b4fd0].

pps:
The following sample code also does not work. For similar sorts of glitchy reasons.
http://developer.apple.com/samplecode/MyFirstJNIProject/MyFirstJNIProject.html
Does Apple worry about this? This code should be for greenhorns, but days of constant
blockages have turned me red with frustration.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.