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.
Indeed I can just open such a .jar file in Finder and the application runs.
Then I set the dock icon for: KEEP IN DOCK.
Then I stop the application .....
..... but: when I click the dock icon again a Terminal starts
with only the Java command without the .jar argument
(so the command comp-laints about: "no argument").
Do you know where the dock icon is administered,
because I have the feeling that when I can edit the command line in there
I can solve almost any problem.
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.
When I drag the .jar from the Desktop (directory) to the dock ... it flies back like a released bird.
The same when I drag it from a file manager.
I just came from MSWindows XP and 7; there I managed to put my application
in the Quick Launch section (for my purpose almost the same situation).
Also I noticed that Eclipse (workbench) sits in the dock as a native application (C?) which
launches the JAVA application Eclipse.
I'm going to dig in there .....
Thanks so far.
More precise: after some vain attempts I successfully dragged it to in-between the Trash bin and the next icon to the left.
Yes that's an improvement; now I can click the .jar which produces a coffee cup and a running application.
Only: the keep-in-dock doesn't work.
Indeed: eclipse is wrapped too.
May I conclude that the dock is only for wrapped app's?
As most of my applications are started from a few, I should only wrap those few to solve the problem.
I also became aware of "TextWrangler", a program to edit plists, a.o. the Dock preferences.
Will study that too.
For the moment, thanks for your time.
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.