Skip navigation

Is there a way to start a JAVA program from the dock?

749 Views 10 Replies Latest reply: Sep 27, 2013 7:25 AM by Sciuriware RSS
Sciuriware Calculating status...
Currently Being Moderated
May 17, 2013 5:26 AM

Hello,

I wrote some JAVA applications and I would like to put them in -

- and start them from - the dock.

These applications were built into .jar files.

I can start them from Finder which tells me that there is some .jar starter utility.

;JOOP!

MacBook Pro with Retina display, OS X Mountain Lion (10.8.2)
  • Topher Kessler Level 6 Level 6 (9,305 points)

    You can often launch the jar file directly, and can drag it to the Dock and simply click it. If you need to use a specific terminal command to launch the jar file (ie, to set specific flags and environmental variables), then you can create an automator "Application" workflow and use the "Run Shell Script" action to do so. You can then save this workflow as an application and place it in the Dock or otherwise directly launch it.

  • andyBall_uk Level 6 Level 6 (17,575 points)

    What happens if you drag the .jar file to the dock, and then click on it ?

  • Barney-15E Level 7 Level 7 (33,370 points)

    Can you just drag the .jar file to the Dock?

     

    However, I really think you should just package it up as Topher suggested.

    .jar files are meant to run from the command line. If you want it to act like a normal application, you need to wrap it up inside some type of wrapper. Besides Automator, there is Platypus: http://sveinbjorn.org/platypus. I'm not sure if it can wrap up java, though. A bit of overkill, i guess.

  • Barney-15E Level 7 Level 7 (33,370 points)

    Drag it to the right side of the dock. It is a document, not an app.

  • Barney-15E Level 7 Level 7 (33,370 points)

    Eclipse is a java "application" because it is packaged in a wrapper that makes it behave like a native app.

  • Barney-15E Level 7 Level 7 (33,370 points)

    The Dock is for Applications, Documents, and Folders (which can take several forms). There are some other odd animals that can stay in the Dock, but they were never truly implemented (recent items is one). If you "wrap" the .jar file inside some package that behaves as an application, you can have it stay in the Dock just as any other Application.

     

    A .jar file is not an application, it's a java archive. It is a collection of classes, metadata, etc. which the Java runtime interprets and executes. The Application which runs it shows up in the Dock as the coffee cup, but that is just the runtime engine, not the .jar.

     

    The .jar is like any other document, such as a a word processing document. Just like any document, it can be double-clicked and the handling application will be called to open it. Double-clicking that word processing document causes the word processing application to open the document and interpret its contents. Double-clicking the .jar file causes the java runtime engine to open the .jar file and interpret its contents. Instead of presenting it as paragraphs of text, it displays it as the application it represents.

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.