Mailing Lists: Apple Mailing Lists

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

Re: weird problem w/ Runtime.exec and application bundle (10.5)



On Dec 20, 2007, at 9:49 AM, Scott Kovatch wrote:


On Dec 20, 2007, at 5:14 AM, Janni Kovacs wrote:

I have a java application which works fine with tiger, but doesn't
work well with leopard.
I'm trying to open the default webbrowser using:
Runtime.getRuntime().exec("open http://www.google.de");
with leopard the safari dock icon just bounces one time then stops and
safari does not open.
Console says:
Safari[2334] No Info.plist file in application bundle or no
NSPrincipalClass in the Info.plist file, exiting
com.apple.launchd[101] ([0x0-0x10b10b].com.apple.Safari[2334]) Exited
with exit code: 1

the important thing: my java application is wrapped by a standard .app
bundle. If I start the jar file manually everything works fine, as it
did with tiger.

From the symptoms you describe, this sounds like a problem with the binary stub in the bundled application.

Bundled applications that were built on certain earlier versions of the OS had a flaw in the stub that keeps them from executing in Leopard. The fix is to re-bundle the application in Leopard. The problem only happens on Intel machines, but unfortunately the workaround added to LaunchServices affects PowerPC systems as well.

The easiest way to tell if this is affecting you is to go to the Terminal and check the Mach-O headers in the binary:

% cd <path to your app>/Contents/MacOS
% otool -arch i386 -lv <app binary> | grep unknown

If something prints out, you've got a bad binary, and you should either rebuild the app on Leopard or replace the stub with an executable shell script with:

-------
#!/bin/sh
exec /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub
-------

Actually, it would be best if you copied the stub to your app instead of writing this script and execing it. We've seen apps that rely on loading libraries relative to the executable path and if you use the shell script approach, your app won't be able to find its libraries. So just copy it in

$ cp /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub <your-app>/Contents/MacOS/<your-binary>

And then try launching your app.

Pratik
 _______________________________________________
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

References: 
 >weird problem w/ Runtime.exec and application bundle (10.5) (From: "Janni Kovacs" <email@hidden>)
 >Re: weird problem w/ Runtime.exec and application bundle (10.5) (From: Scott Kovatch <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.