JavaCompiler: isSupportedOption(String option) : JavaCompiler « javax.tools « Java by API
- Java by API
- javax.tools
- JavaCompiler
JavaCompiler: isSupportedOption(String option)
import java.util.Set;
import javax.lang.model.SourceVersion;
import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;
public class Main {
public static void main(String[] args) {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
Set<SourceVersion> srcVer = compiler.getSourceVersions();
for (SourceVersion sv : srcVer)
System.out.println(" " + sv.name());
int nargs = compiler.isSupportedOption(args[0]);
if (nargs == -1)
System.out.println("Option " + args[0] + " is not supported");
else
System.out.println("Option " + args[0] + " takes " + nargs + " arguments");
}
}
Related examples in the same category
1. | JavaCompiler: getStandardFileManager(DiagnosticListener super JavaFileObject> arg0, Locale arg1, Charset arg2) | | |
2. | JavaCompiler: getTask(Writer arg0, JavaFileManager arg1, DiagnosticListener super JavaFileObject> arg2, Iterable arg3, Iterable arg4, Iterable extends JavaFileObject> arg5) | | |
3. | CompilationTask: call() | | |
4. | Tool: run(InputStream in, OutputStream out, OutputStream err, String... arguments) | | |