Java by API/java.util/ServiceLoader
ServiceLoader: load(Class<JavaCompiler> service)
import java.util.ServiceLoader;
import javax.tools.JavaCompiler;
public class Main {
public static void main(String[] args) {
ServiceLoader<JavaCompiler> compilers = ServiceLoader.load(JavaCompiler.class);
System.out.println(compilers.toString());
for (JavaCompiler compiler : compilers)
System.out.println(compiler);
}
}
ServiceLoader: toString()
import java.util.ServiceLoader;
import javax.tools.JavaCompiler;
public class Main {
public static void main(String[] args) {
ServiceLoader<JavaCompiler> compilers = ServiceLoader.load(JavaCompiler.class);
System.out.println(compilers.toString());
for (JavaCompiler compiler : compilers)
System.out.println(compiler);
}
}