package java_javacompiler; import java.util.Set; import javax.lang.model.SourceVersion; import javax.tools.JavaCompiler; import javax.tools.ToolProvider; public class Java_JavaCompiler { public static void main(String[] args) { JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler(); System.out.print(javaCompiler.toString()); Set<SourceVersion> sourceVersion; sourceVersion = javaCompiler.getSourceVersions(); for (SourceVersion version : sourceVersion) { System.out.print(version.name() + "\n"); } } }
Wednesday, March 18, 2015
Get System Java Compiler and check sourceVersion
Example to get System Java Compiler by calling ToolProvider.getSystemJavaCompiler(), and check sourceVersion with getSourceVersions().
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment