List of usage examples for javax.tools JavaFileManager getJavaFileForInput
JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException;
From source file:org.cdmckay.coffeep.Program.java
private static JavaFileObject getFileObject(String className) throws IOException { final Context context = new Context(); final JavaFileManager fileManager = new JavacFileManager(context, true, null); JavaFileObject fileObject;/*from w w w . j ava 2 s .c o m*/ fileObject = fileManager.getJavaFileForInput(StandardLocation.PLATFORM_CLASS_PATH, className, JavaFileObject.Kind.CLASS); if (fileObject != null) return fileObject; fileObject = fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, className, JavaFileObject.Kind.CLASS); if (fileObject != null) return fileObject; final StandardJavaFileManager standardFileManager = (StandardJavaFileManager) fileManager; return standardFileManager.getJavaFileObjects(className).iterator().next(); }