You need to map the class name (e.g. "foo.Bar"
) to a resource path name (e.g. "/foo/Bar.class"
) and then use classLoader.getResourceAsStream
to open a stream to read the bytecode file.
In theory, this can then be fed to a decompiler ... assuming that you have a decompiler that can read from an InputStream
.
What you are doing at the moment fails because a Class
object cannot be serialized.