Example usage for javax.tools JavaCompiler isSupportedOption

List of usage examples for javax.tools JavaCompiler isSupportedOption

Introduction

In this page you can find the example usage for javax.tools JavaCompiler isSupportedOption.

Prototype

int isSupportedOption(String option);

Source Link

Document

Determines if the given option is supported and if so, the number of arguments the option takes.

Usage

From source file:Main.java

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/*  w  ww. j a  v a2s .  c  o m*/
        System.out.println("Option " + args[0] + " takes " + nargs + " arguments");
}

From source file:CompilerInfo.java

public static void main(String[] args) {
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    System.out.println("Supported source versions:");
    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/*w  w  w. j av  a 2 s  . c o  m*/
        System.out.println("Option " + args[0] + " takes " + nargs + " arguments");
}