public RobolectricClassLoader(ClassHandler classHandler, List<String> customClassNames) { super(RobolectricClassLoader.class.getClassLoader(), null); delegateLoadingOf(AndroidTranslator.class.getName()); delegateLoadingOf(ClassHandler.class.getName()); final String classCachePath = System.getProperty("cached.robolectric.classes.path"); final File classCacheDirectory; if (null == classCachePath || "".equals(classCachePath.trim())) { classCacheDirectory = new File("./tmp"); } else { classCacheDirectory = new File(classCachePath); } classCache = new ClassCache(new File(classCacheDirectory, "cached-robolectric-classes.jar").getAbsolutePath(), AndroidTranslator.CACHE_VERSION); try { ClassPool classPool = new ClassPool(); classPool.appendClassPath(new LoaderClassPath(RobolectricClassLoader.class.getClassLoader())); androidTranslator = new AndroidTranslator(classHandler, classCache, customClassNames); addTranslator(classPool, androidTranslator); } catch (NotFoundException e) { throw new RuntimeException(e); } catch (CannotCompileException e) { throw new RuntimeException(e); } }