JavaCompiler: isSupportedOption(String option) : JavaCompiler « javax.tools « Java by API






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 arg0, Locale arg1, Charset arg2)
2.JavaCompiler: getTask(Writer arg0, JavaFileManager arg1, DiagnosticListener arg2, Iterable arg3, Iterable arg4, Iterable arg5)
3.CompilationTask: call()
4.Tool: run(InputStream in, OutputStream out, OutputStream err, String... arguments)