MediaWiki is the underlying software of Wikipedia. It is open source software licensed under the GPL. It is written in PHP and (I think) requires a MySQL database. It's fairly easy to set up, widely supported and straight forward to use.
Lots of Java wikis are listed in http://java-source.net/open-source/wiki-engines. For a new project I'd go with JSPWiki, which has a nice feature set, and is actively developed. For heavy-duty stuff (high-end features, lots of customization in Java) I think XWiki is very interesting.