I'm new to zsh in Catalina. In .zshrc, I currently have

setopt CORRECT

When I run a java program from the command line, I want only:

% java ProgramName

If I type java Pro autocomplete adds the rest of the name but also appends .class. (Or, if I have the source file in the same directory, it appends the . after the name) and I then have to delete .class (or hit the backspace once) before I can run the program.

Is there a way to get zsh autocomplete to omit .class (and .) but only when the initial command is java?

I'd prefer not to install something like Oh My Zsh which might alter my other zsh settings.

1 Answer 1


It appears you are still using Zsh's legacy completion system. You can upgrade to "new" completion system (released back in 🛸the year 2000🛸) by adding this to your .zshrc file:

autoload -Uz compinit

Then you'll see that Zsh's java completion will no longer add .class.

  • @RPW Does this answer your question? Jan 18, 2021 at 13:09
  • Sorry for delay in responding. Have since moved to Big Sur and this worked perfectly and have marked as such.
    – RPW
    May 12, 2021 at 13:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .