Smarter Bash Tab Completion
*nix packages such as bash_completion can be installed with 3rd party package managers. I suggest Homebrew, but Fink and MacPorts also provide the bash_completion package. If it doesn't auto-handle the Java situation you describe, post back or read the man page.