You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Richard Van Deren <rv...@mac.com> on 2004/10/02 23:34:18 UTC

Java VM version query, Apache Fop, Java 1.4.2 Update 1

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