I advise against the use of Java, unless there is a library that you desperately need. I did an NLP final project in Java once and found that it lacks a lot of flexibility that is often needed (strict type system, no anonymous functions etc.). Unfortunately, I don't know OCaml, but in case you know Python, there are a lot of NLP libraries available for that, e.g., the very comprehensive and actively developed NLTK.