public static ClassLoader compile(List<SourceFile> files) throws CompilationError {
      System.out.println("got here1");
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    if (compiler == null) throw new Error("Only JDK contains the JavaCompiler, you are running a Java JRE");
    MyDiagnosticListener diagnisticListenerForErrors=new MyDiagnosticListener();
    final HashMap<String,ClassFile> map=new HashMap<>();
    final ClassLoader classLoader=new java.security.SecureClassLoader(model.AI.class.getClassLoader()) {      
      @Override
      public Class<?> loadClass(String name)throws ClassNotFoundException {
          System.out.println("got here2");
        return this.loadClass(name, false);}
      @Override
      public Class<?> loadClass(String name,boolean resolve)throws ClassNotFoundException {
          System.out.println("got here3");
        if(!map.containsKey(name))return super.loadClass(name,resolve);
    	//if(!map.containsKey(name))return cl.loadClass(name);
        ClassFile jclassObject = map.get(name);
        return super.defineClass(name, jclassObject.getBytes(), 0, jclassObject.getBytes().length);
        }
      };
    final ForwardingJavaFileManager<StandardJavaFileManager>  classFileManager=
        new ForwardingJavaFileManager<StandardJavaFileManager>(compiler.getStandardFileManager(diagnisticListenerForErrors,Locale.ENGLISH, null)){
      @Override
      public ClassLoader getClassLoader(Location location) {return classLoader;}
      @Override
      public JavaFileObject getJavaFileForOutput(Location location,String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException{
        ClassFile classFile=new ClassFile(className, kind);
        map.put(className, classFile);
        return classFile;
        }
      };    
    if(!compiler.getTask(/*out:*/null,classFileManager,diagnisticListenerForErrors,
        /*compilerOptions:*/new ArrayList<String>(Arrays.asList("-classpath", ".;C:\\Users/Simon/workspace3/Questions/build/classes")),/*StringsClasses??:*/null,files
      ).call()
        ){System.out.println(diagnisticListenerForErrors.diagnostic);throw new CompilationError(diagnisticListenerForErrors.diagnostic);    }
    return classLoader;
    }