There are some nice examples on the JavaCompiler page you're linked to. They invoke the compiler with the following line of code:
compiler.getTask(null, fileManager, null, null, null, compilationUnits1).call();
The fourth argument to the getTask method is a list of parameter strings (indeed Iterable<String> , but the list will suffice). So you can do:
compiler.getTask(null, fileManager, null, Arrays.asList("-Xlint:all"), null, compilationUnits1).call();
source share