How to use `application` plugin for executable jar?

I’ve gotten as far as having:

apply plugin: `application`

startScripts {
  defaultJvmOpts += '-jar'
  defaultJvmOpts += '../lib/example-0.1.0-dev.1.uncommitted+6e69c9f.jar'

The problem, though, is that the script must be run from its location (ie $(dirname $0)) but I haven’t found a way to do that. It does look like that happens by default if the script in run from the Mac Finder. Can the cd $(dirname $0) that’s in the generated start script be done all the time?