To disable, open Terminal and run
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
This disables the Launch Daemon that starts and keeps it running. You can also run:
sudo mdutil -a -i off
but from looking online in a few places, this may give you an error like 'Spotlight server is disabled'
If you disable though, it will continue to use an old cache, or not work at all. Therefore, the launching applications as you mention will no longer work. It also may break other functions related to the OS, like the Mac App Store (to know whats installed, etc), and LaunchPad.
If you still need an application launcher, you can use applications like LaunchBar and Quicksilver.
After seeing your update (espc. on how to stop it indexing so much), there are two things to check:
- Are you running something like a virus scanner or other application constantly accessing files on your drive? This will force spotlight to keep indexing. A network share would also be a culprit.
- You can also filter what folders Spotlight should index, and by configuring this, can limit how much has to be indexed. Do do this, go to System Preferences -> Spotlight -> Privacy.
Re-enabling would be running
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
or
sudo mdutil -a -i on
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.
Best Answer
To the best of my knowledge this is expected behavior. The dock has been doing that (probably) since the 10.0 public beta.
Unfortunately I have seen nothing online, either in App form or a shell or applescript, that would prevent this from happening. Perhaps someone else has run across something that would do this.