Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 18, 2012, 06:13 PM   #1
iindigo
macrumors 6502a
 
iindigo's Avatar
 
Join Date: Jul 2002
Location: Palo Alto, CA
Send a message via AIM to iindigo
Problems wrapping a jar file into an app bundle

First of all, just let me say that I apologize if I misuse any Java terminology. It's not my field of expertise - I'm an Obj-C/Cocoa guy, so some Java stuff gets me completely lost.

I'm trying to make a Java app that I use frequently a little more Mac friendly. Normally, it's just a bare .jar and so lacks many things, such as a proper app name, dock icon, and Mac menubar usage.

I still have a copy of the Jar Bundler included with Xcode 3. The bundles it produces work nicely for the most part, but it has a problem with this particular jar file. For whatever reason, the Use Macintosh Menu Bar option doesn't work. In fact, it's completely ignored, and the app's menus remain attached to its window.

I do not have access to the source.

What could cause the menubar option to fail? Is there anything I can do without first acquiring the source?


P.S. It's no big deal if it's not possible, but is there some way I can force the application to use native (or closer to native) file dialogs instead of the mediocre-at-best standard Java ones?
iindigo is offline   0 Reply With Quote
Old Jan 18, 2012, 10:05 PM   #2
foidulus
macrumors 6502a
 
Join Date: Jan 2007
Quote:
Originally Posted by iindigo View Post
First of all, just let me say that I apologize if I misuse any Java terminology. It's not my field of expertise - I'm an Obj-C/Cocoa guy, so some Java stuff gets me completely lost.

I'm trying to make a Java app that I use frequently a little more Mac friendly. Normally, it's just a bare .jar and so lacks many things, such as a proper app name, dock icon, and Mac menubar usage.

I still have a copy of the Jar Bundler included with Xcode 3. The bundles it produces work nicely for the most part, but it has a problem with this particular jar file. For whatever reason, the Use Macintosh Menu Bar option doesn't work. In fact, it's completely ignored, and the app's menus remain attached to its window.

I do not have access to the source.

What could cause the menubar option to fail? Is there anything I can do without first acquiring the source?


P.S. It's no big deal if it's not possible, but is there some way I can force the application to use native (or closer to native) file dialogs instead of the mediocre-at-best standard Java ones?
Is the menu bar there when you launch it as a jar? You can set a Java system property that will enable/disable the menu bar at the top of the screen, the default is to put it on the top, but if the coders set that system property then it won't appear there.
foidulus is offline   0 Reply With Quote
Old Jan 19, 2012, 02:25 AM   #3
iindigo
Thread Starter
macrumors 6502a
 
iindigo's Avatar
 
Join Date: Jul 2002
Location: Palo Alto, CA
Send a message via AIM to iindigo
Yeah, the menubar is on the window when I launch the bare jar file.
iindigo is offline   0 Reply With Quote
Old Jan 19, 2012, 02:39 AM   #4
thundersteele
macrumors 68030
 
Join Date: Oct 2011
Automator can do this.

Open Automator, create a new application, then drag the "run shell script" into the window on the right. In the "run shell script" window, type

java -jar /path/to/app.jar

I'm not sure if something else is needed for java, but this is how I created launch icons for some of the macports I installed.
thundersteele is offline   0 Reply With Quote
Old Jan 19, 2012, 09:32 AM   #5
chown33
macrumors 603
 
Join Date: Aug 2009
If you told us exactly what the Java app was, and the URL of where to get it, then maybe someone could take a closer look at it.

Without specifics, all anyone can do is guess about why it's not doing what you want.
chown33 is offline   0 Reply With Quote
Old Jan 19, 2012, 04:39 PM   #6
nehalvpatel
macrumors newbie
 
Join Date: Aug 2010
I ran into a similar problem, and I did this (I'm not sure if that's exactly what you wanted, but here you go!):
Code:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    system("open /Applications/name.jar");
    [NSApp terminate:(0)];
}
All it does is launch the .jar and then quit the current app.
nehalvpatel is offline   0 Reply With Quote
Old Jan 19, 2012, 11:26 PM   #7
foidulus
macrumors 6502a
 
Join Date: Jan 2007
ok, so it's not set in the code then. Try adding this to the <Properties> section of the Info.plist file in the .app directory:


Code:
                <key>Properties</key>
                <dict>
                        <key>apple.laf.useScreenMenuBar</key>
                        <string>true</string>
                </dict>
That will tell the app to use the screen menu bar.
foidulus is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting 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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
make a folder an app bundle gobigorange Mac Basics and Help 0 Mar 21, 2011 06:56 PM
Embedding .Jar files into iWeb nomar383 Web Design and Development 3 Sep 8, 2008 10:01 AM
Wrap a WAP site into an app sparetire iPhone/iPad Programming 0 Aug 9, 2008 02:57 AM
Can you covert multiple .dmg files into an ISO? techster82 Mac Applications and Mac App Store 8 Feb 7, 2006 01:18 AM
Two targets into one app bundle? caveman_uk Mac Programming 2 Jun 6, 2005 09:15 AM


All times are GMT -5. The time now is 05:47 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC