Bash autocompletion + Java

I think the title says it all, I was just checking something at work and needed to run one of our Java apps using the command line, I did the standard:
java -cp jarfile1.jar:jarfile2.jar

and hit tab key twice out of habit and to my surprise bash had checked the jar files inside the command I was writing and presented me with all the class options!!

Bash auto completion just continues to impress me! Thank you bash, you have just made my life SO much easier yet again.

For those of you who have no idea what bash is, its a terminal shell used by default in Linux.. so for those of you out there not yet using Linux, here is yet another reason to do so.

OSX also uses bash as the default shell for the terminal, so I’ll now have to test it on my macbook.. after a quick test the answer is no, OSX is either using an older version of bash which doesn’t support this feature, or hasn’t turned on/set up all the autocompletion features by default.

Leave a Reply

Your email address will not be published.