MacOS – How to use Keep in Dock option with applications started form the console

findermacos

I tried to use Keep in Dock option with a Java application that is started from the command line but when I try to restart the application it will fail – and this is happening because it will start java without any parameters.

There are two ways of starting the application on OS X but both of them fail if you want to use the Keep in Dock option.

  • start it using the shell script olv.sh
  • start the jar file logview.jar by clicking on it in Finder.

In case you want to debug, the application is http://code.google.com/p/otroslogviewer but I know that the same problem applies for other apps too.

How can I solve the problem so I can start the application from Dock and eventually from Finder also.

Best Answer

You could write a shell script to invoke the java app with the parameters you need, then wrap it up in an app with Platypus.

The resultant app can then be put in the Dock like any other app.

I've used it for a variety of tasks, such as popping-up a help screen with a serial number for users to enter for a recalcitrant app which didn't like mass deployment and would ask the user to enter it at first run, to a complicated script which mounted a disk-image of a science textbook's additional media DVD and then ran the associated app to access the content. Platypus even allowed me to roll the disk-image into the final app itself, making deployment easier.