I'm playing with reflection on Android. I've saved JAR file on device and I'm trying to get class from this JAR but it isn't working and I'm getting exception:
java.lang.ClassNotFoundException: Main.class
My code:
File classFile = new File(getExternalFilesDir(null) + File.separator);
URLClassLoader classLoader = new URLClassLoader(new URL[] { classFile.toURI().toURL() });
Class classToInvestigate = classLoader.loadClass("Main.class");
Also I tried saved there Main.class file, but I'm still getting errors. Is there something I'm missing? Thank you.
Aucun commentaire:
Enregistrer un commentaire