Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > mac deployment

mac deployment
Thread Tools
Fresh-Faced Recruit
Join Date: May 2009
Status: Offline
Reply With Quote
May 15, 2009, 10:55 AM
 
hi everyone,

I hope I can get some info here, otherwise, please redirect to another more specific forum.

I'm deploying an application for Mac, it is not a common application in term of structure. It is basically an Adobe AIR application but started by a java class.

Here is the structure of the app:

/MyApp/Info.plist
/MyApp/MacOS/
/MyApp/MacOS/JavaApplicationStub (this starts the runnable jar)
/MyApp/MacOS/SomaUI (this is started by the runnable jar and starts the AIR app)
/MyApp/PkgInfo
/MyApp/Resources/
/MyApp/Resources/Java/
/MyApp/Resources/Java/MyApp.jar
/MyApp/Resources/icons.icns
/MyApp/Resources/rest of my air application...

when I type in the terminal:
java -jar MyApp.jar

java starts, start the air app (which is basically the content of a AIR app install: MyAirApp.app)

Everything works so far.

But when I try to start the real app (made with jar Bundler) by double clicking on it, I got:

LSOpenFromURLSpec() failed with error -10810 for the file /Users/romuald/Desktop/MyApp/MyApp.app.

I guess my runnable jar is not found?

Here is my Info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleName</key>
<string>MyApp</string>
<key>CFBundleVersion</key>
<string>10.2</string>
<key>CFBundleAllowMixedLocalizations</key>
<string>true</string>
<key>CFBundleExecutable</key>
<string>JavaApplicationStub</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>Java</key>
<dict>
<key>MainClass</key>
<string>Main</string>
<key>JVMVersion</key>
<string>1.5*</string>
<key>ClassPath</key>
<string>$JAVAROOT/MyApp.jar</string>
</dict>
</dict>
</plist>

Can anyone tells me what I'm missing?

Thanks in advance.

Romu
     
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status: Offline
Reply With Quote
May 15, 2009, 06:33 PM
 
I don't know that I can solve you problem directly, but I do have a pair of notes:

- Apple has been seriously depreciating the Cocoa-Java bridge that it seems you are depending on. I would strongly recommend finding another route for this.

- Why are you doing this fancy redirection using Java to launch an AIR application? I can't figure out why you would do that. If you can share your reasoning the group can probably come up with a better supported route of getting what you want done done.
     
Fresh-Faced Recruit
Join Date: May 2009
Status: Offline
Reply With Quote
May 18, 2009, 04:24 AM
 
Absolutely, I'm using a java-AIR bridge (Merapi project). This bridge allows me to send and receive messages from java in AIR app (making me able to execute files and use the java-power from an AIR app). The java instance has to be started before the AIR in order to work correctly, so the best way is start java -> java is starting the bridge and then launch the AIR app.

Everything is working correctly on Windows and it is just a matter of having a app folder that is starting correctly the executable jar. As I said, when I start my executable jar from the console, java starts and the AIR app is launched. Only when I double click on the app (that should start that jar), it fails. I can see this error when I type "open MyApp.app" in the console, double clicking make it fail silently (I see the icon in the 1 sec though).

I can share files if someone would be kind enough to have a look, I'm a bit lost on that one.

Please help

Thanks in advance.

Romu
     
Clinically Insane
Join Date: Oct 2000
Location: Los Angeles
Status: Offline
Reply With Quote
May 18, 2009, 07:59 AM
 
I'm mostly just an end user, but I'm wondering if, aside from looking up that particular error code (if you haven't already), you could try inspecting a working Java app package that does something similar to verify that your plist is all correct.

Newt 2012-The Republican Revolution Returns!
     
Fresh-Faced Recruit
Join Date: May 2009
Status: Offline
Reply With Quote
May 18, 2009, 08:13 AM
 
Basically I used something similar I've already built using java SWT (with a startOnMainThread property, so it was working), but it doesn't work for that one. This app was starting a executable jar, exactly what I'm trying to do.

I believe something is wrong in the plist but I'm not pretty sure :/
     
Clinically Insane
Join Date: Oct 2000
Location: Los Angeles
Status: Offline
Reply With Quote
May 18, 2009, 09:40 AM
 
Wish I had more help to offer.

Newt 2012-The Republican Revolution Returns!
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
May 18, 2009, 08:35 PM
 
Originally Posted by Romustep View Post
Basically I used something similar I've already built using java SWT (with a startOnMainThread property, so it was working), but it doesn't work for that one. This app was starting a executable jar, exactly what I'm trying to do.

I believe something is wrong in the plist but I'm not pretty sure :/
Have you confirmed that everything (that ought to be) is set as executable?
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Fresh-Faced Recruit
Join Date: May 2009
Status: Offline
Reply With Quote
May 20, 2009, 06:00 AM
 
that's a runnable jar, so yes it is.

I think I found the problem and it is a java one. When java is starting the second app, I found out that an absolute path was working!

But impossible to make it work with a relative one, I tried everything.

So the trick is calculate the absolute path of my app, append the relative one I need and use those relative path to execute the other.

Not done yet, I'll try this evening but it should work.

Thanks for your help guys!
     
Fresh-Faced Recruit
Join Date: May 2009
Status: Offline
Reply With Quote
May 21, 2009, 04:43 AM
 
Still not right, I can't get it work.

It means the path I get in Java using : new File("").getAbsolutePath()
is not returning me the one of the jar :s

Any idea?
     
Fresh-Faced Recruit
Join Date: May 2009
Status: Offline
Reply With Quote
May 21, 2009, 05:08 AM
 
I finally found it, I post the solution here in case other non-java developer like me have the problem:

My first try was to launch the app using a relative path: no success

Second try was getting the app absolute path using in my main class:
String absPath = new File("").getAbsolutePath();
substring "/Resources/Java" and add the other relative path
still no success

The solution is using the Class.class.getResource():
String absPath = Main.class.getResource("/").toString();
// remove "file:" at the beginning and "/Resources/Java" at the end
absPath = absPath.substring(5, absPath.length() - 16);
// MyAirAppToLaunch is the script created by the Flex AIR exporter when the app is created
String path = absPath + "/MacOS/MyAirAppToLaunch";

Hope it helps

Romu
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:56 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2