Which Vim version?
The default Vim 7.3.000 install ships syntax/java.vim
with a version of 2010 March 23
; the latest runtime files (from Mercurial repo) have 2012 Oct 05
; both can do Java folding. I strongly recommend you to upgrade.
If you cannot do this, put the following into ~/.vim/after/syntax/java.vim
:
if v:version < 703
" The default Java syntax file lacks the 'fold' option.
syn region javaFold start="{" end="}" transparent fold
endif