Re: Java VM version query
Re: Java VM version query
- Subject: Re: Java VM version query
- From: Brent Gulanowski <email@hidden>
- Date: Tue, 5 Oct 2004 14:09:07 -0400
Richard,
I wasn't reading sufficiently carefully and missed one point -- you
say that the Java key/dictionary are to be added to the application.
Does this mean that a Foundation tool (which by definition has no
info.plist) cannot access Java classes using this method? Anyway that
is my discovery when I tried to add the key to the info.plist of a
framework since I was testing this using only a tool.
On Sat, 2 Oct 2004 14:41:14 -0400, Richard Van Deren <email@hidden> wrote:
>
Thanks for everybody's help. This is a report on my problem, several
>
solutions along the way. My goal was to get Apache FOP to work in a
>
Cocoa Application, correctly.
>
BTW, I am still looking for a query in Objective-C Cocoa to query the
>
JVM Version. Thanks for the Java examples.
>
>
I was feeling so alone just talking to Sun Java error messages and
>
reading Apple Java error messages and documentation.
>
>
Here is my problem restated, before I give you the solution.
>
>
I was first hit by Apple's, Java 1.4.2 Update 1. This created an
>
error where Java AWT could not be started on the main thread. That is
>
the Objective-C Cocoa NSThread, not a Java Thread.
>
I am happy now that I know enough of about Objective-C threads to get
>
me in trouble. Using a detached worker thread I was then able to FOP
>
again.
>
You can reproduce this problem with: TestXSLT, download URL below.
>
2004-10-02 13:49:08.736 TestXSLT[10860] Apple AWT Java VM was loaded
>
on first thread -- can't start AWT.
>
2004-10-02 13:49:08.790 TestXSLT[10860] java/lang/InternalError:
>
Can't start the AWT because Java was started on the first thread.
>
>
I then rewrote my working Apache FOP Cocoa system service as a
>
Framework. I embedded my framework and the NSClassFromString
>
function returned nil. I then learned about the obj-c foundation
>
NSJava ... functions. They lead me to the now famous "Unsupported
>
major minor version 48" message. It was fun learning about Java byte
>
codes and remembering basic programming rules about writing clear
>
messages. It took me a couple of days to translate this message to
>
"The Java VM that you are running on is not in the range that this
>
class was compiled. Please check your VM version or recompile this
>
class."
>
>
Now that I had a problem, with your help and a little googling, I was
>
able to edit my info.plist and I added the following key with a
>
dictionary:
>
<key>Java</key>
>
<dict>
>
<key>JVMVersion</key>
>
<string>1.4+</string>
>
</dict>
>
This was needed because I was using Xcode 1.5 native target and Java is
>
not supported in the inspector, however the target inspector allows for
>
editing the info.plist as a file in the Properties tab. The
>
application is edited not the framework where the java is located.
>
This confused be for a while. Note this was a legacy cocoa framework.
>
I used this form because Java is not supported yet as a native target.
>
The framework is also used because Apache FOP needs to be a plug-in of
>
some sort.
>
>
I will post my framework to the Apache FOP group and/or put it on my
>
web site when it matures a little.
>
>
I am a fan of Formatting Objects. I hope Apple will be someday.
>
>
sites I used to solve this problem.
>
Formatting Objects: http://xml.apache.org/fop/
>
TestXSLT Cocoa example error:
>
http://www.entropy.ch/phpbb2/viewtopic.php?t=1450
>
TestXSLT download: http://www.entropy.ch/software/macosx/#testxslt
>
Framework Tutorial Movie:
>
http://rentzsch.com/cocoa/embeddedFrameworks
>
Reported as apple bug:
>
https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa
>
http://bugreport.apple.com
>
Problem ID: 3776689 Title: Update 1: Apache FOP, Formatting Objects
>
fails when starting AWT
>
Originator: Richard Van Deren Closed Created Date: 26-Aug-2004 04:22 AM
>
________________________________________________________
>
Rich Van Deren
>
>
http://homepage.mac.com/rvanderen/WhereIsRich.html
>
On Oct 2, 2004, at 1:06 AM, Mike Hall wrote:
>
>
>> Richard Van Deren wrote:
>
>
>
>> How do you know which version of the Java VM an Cocoa application is
>
>> using?
>
>>
>
>> My application seems to be using Java VM 1.3 when it should be using
>
>> Java
>
>> VM 1.4
>
>
>
>> Cocoa-Java programs use a different mechanism than "pure Java"
>
>> programs do.
>
>
>
>> The "pure Java" mechanism is a "Java" dictionary in Info.plist:
>
>
>
> Ah, I was forgetting Cocoa-java was different here.
>
>
>
> I did come across this fairly new documentation, not Cocoa specific
>
> but if of interest.
>
>
>
> http://developer.apple.com/technotes/tn2002/tn2110.html
>
>
>
> The semi-serious caveat I mentioned in passing.
>
>
>
> http://developer.apple.com/qa/qa2001/qa1342.html
>
>
>
> Pretty brief and not real encouraging to Cocoa-Java development. List
>
> clarifications were actually more detailed but not much better as far
>
> as your coding prospects as I remember and you can find those on the
>
> archives.
>
>
>
> Since again I use my own Cocoa interface and that is JNI based I guess
>
> I'm safe here.
>
> Hard to say. With either normal, somewhat supported Cocoa-Java or my
>
> own I figure it's like anything else, you try it and what works is ok
>
> and what doesn't isn't.
>
>
>
> Well, I didn't want to leave this with some mysterious and vague and
>
> unsubstantited accusation. I can go back to bed now feeling better.
>
>
>
> Mike Hall mikehall at spacestar dot net
>
> http://www.spacestar.net/users/mikehall
>
>
>
>
>
>
>
>
>
> _______________________________________________
>
> Do not post admin requests to the list. They will be ignored.
>
> Java-dev mailing list (email@hidden)
>
> Help/Unsubscribe/Update your Subscription:
>
>
>
> This email sent to email@hidden
>
>
>
>
--
Brent Gulanowski
http://www.boredastronaut.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden