How do I make a java.io.File into a java.lang.Class to run it?
I have a program that lets a user select any .class or .jar file and run it. The problem is that, to run it, I need to use something other than a java.io.File, which is what a JFileChooser returns. How can I make a java.io.File into a java.lang.Class or java.util.jar.JarFile?
If you have a File object of the class you want to load, you can use a URLClassLoader to load the class. The File object can provide the URL.