Package javax.tools

Examples of javax.tools.JavaFileManager


    Context context = new Context();
    boolean success = false;
    Throwable failTrace = null;
    try {
      Class<?> dfm = Class.forName("com.sun.tools.javac.util.DefaultFileManager");
      JavaFileManager instance = (JavaFileManager) dfm.getConstructor(Context.class, boolean.class, Charset.class).newInstance(context, true, Charset.forName("UTF-8"));
      context.put(JavaFileManager.class, instance);
      success = true;
    } catch (Throwable t) {
      //Either DFM, or its replacement JFM, exists (or possibly both in odd classpath configurations). If something is wrong, NoMethodDefErrors and the like occur.
      failTrace = t;
    }
   
    try {
      Class<?> jfm = Class.forName("com.sun.tools.javac.util.JavacFileManager");
      JavaFileManager instance = (JavaFileManager) jfm.getConstructor(Context.class, boolean.class, Charset.class).newInstance(context, true, Charset.forName("UTF-8"));
      context.put(JavaFileManager.class, instance);
      success = true;
    } catch (Throwable t) {
      //Either DFM, or its replacement JFM, exists (or possibly both in odd classpath configurations). If something is wrong, NoMethodDefErrors and the like occur.
      failTrace = t;
View Full Code Here

TOP

Related Classes of javax.tools.JavaFileManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.