java - Download .class file and load it into JVM -
How can I download a .class file and load it in jvm with square loader, I have written That a simple code is a .class file I tried to load it into JVM.
the face of the public square {Public static throws IOException the main (string [] AGR), the classnamefound exception {file F = new file ("Task Class"); integer number; Byte [] buffer = new byte [1024]; DataInputStream dis = New DataInputStream (new FileInputStream (f)); Stringbuilder all = new stringbillers (); While ((count = DAP (buffer)) gt; 0) {// System.out.write (buffer, 0, count); all.append (buffer); // System.out.flush (); } File b = new file ("Task Class"); FileOutputStream fos = New FileOutputStream (b); DataOutputStream dos = new dataoutputstream (fos); Dos.write (all.toString () getBytes ().); Classloader lod = face.class.getClassLoader (); Lod.loadClass (b.getAbsolutePath ()); }}
Use class.forName (& lt; package_qualified_class_name & Gt;)
Comments
Post a Comment