0

I recently wrote a small Java application with Eclipse and packaged the exported Runnable Jar using Apple's Jar Bundler. Everything works great, except my plist keys for hiding the application icon in the dock. I have tried previous plist keys I have used before to hide my dock icon, but they are not working. I run my app, the icon shows up in the dock and sits there bouncing for a while, then it stops bouncing and just sits there. I don't want the Dock icon shown, and I don't want a system tray icon. I am just needing my app to run in the background.

Keys I have tried and had no luck.

apple.awt.UIElement true

and

Application is agent (UIElement) set to True/Yes in Plist Editor

UPDATE: Here is my plist. My app still bounces in the dock. If I let it sit for a while it will eventually start to work.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>LSUIElement</key>
    <string>1</string>
    <key>CFBundleName</key>
    <string>My App</string>
    <key>CFBundleIdentifier</key>
    <string>org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader</string>
    <key>CFBundleVersion</key>
    <string>100.0</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>CFBundleGetInfoString</key>
    <string>My App</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleIconFile</key>
    <string>icon.icns</string>
    <key>Java</key>
    <dict>
        <key>WorkingDirectory</key>
        <string>$APP_PACKAGE/Contents/Resources/Java</string>
        <key>MainClass</key>
        <string>org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader</string>
        <key>JVMVersion</key>
        <string>1.6+</string>
        <key>ClassPath</key>
        <string>$JAVAROOT/myapp.jar</string>
        <key>Properties</key>
        <dict/>
    </dict>
</dict>
</plist>

UPDATE 2: When I run my java application using terminal command sudo open /Applications/MyJava.app it runs fine. If I run my app normally, and let it bounce on the dock for a while it will eventually run. I would prefer not prompting the user for credentials to just run my simple app.

Dr-ZoidBerg
  • 41
  • 3
  • 10
  • Have you tried this? http://stackoverflow.com/a/2762735/270157 – Goibniu Feb 07 '14 at 17:35
  • I have, but it did not work either. Application still jumps up and down on the dock, then goes to "Application Not Responding". Again, my JAR file runs perfectly, zero issues. Just when I package as an APP using Jar Bundler. – Dr-ZoidBerg Feb 07 '14 at 18:54

1 Answers1

1

In your plist: java -Djava.awt.headless=true

or

in your code: System.setProperty("java.awt.headless", "true");

martinez314
  • 12,162
  • 5
  • 36
  • 63
  • I am beginning to think there is something wrong with my packaged .app, I have a launch agent set to run the file at login. It runs the JavaApplicationStub inside of the .app, so if I restart my computer it will run after a little bit. I will be posting up my plist a little later. – Dr-ZoidBerg Feb 10 '14 at 14:54