Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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");
    }
}