Make filename extensions hidden in specific folder (Desktop) or file (.jar)
You can write an AppleScript that uses Finder’s extension hidden property to do this. See the accepted answer here:
https://superuser.com/questions/399899/show-hide-extension-of-a-file-through-os-x-command-line