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

Similar Threads
thread Thread Starter Forum Replies Last Post
Sparse Bundle Backup Problems explode90 OS X 4 Feb 9, 2014 01:33 AM
What strategy to change bundle ID/App name ChristianJapan App Store Business, Legal and Marketıng 1 Sep 17, 2013 09:18 AM
The Java JAR file “whatever.jar” could not be launched. Shivetya OS X 0 Jul 31, 2013 04:33 PM
MBP (Late 2011) Unable to access Jar File... DEATHCON51 MacBook Pro 5 Jan 17, 2013 08:17 PM
Bundle Identifier affect app icon ppn iPhone/iPad Programming 2 Jul 18, 2012 09:41 PM

Forum Jump

All times are GMT -5. The time now is 01:50 AM.

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

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