/** * Starts a program. */ public static void main(String[] args) throws Throwable { if (args.length >= 3) { Viewer cl = new Viewer(args[0], Integer.parseInt(args[1])); String[] args2 = new String[args.length - 3]; System.arraycopy(args, 3, args2, 0, args.length - 3); cl.run(args[2], args2); } else System.err.println( "Usage: java javassist.tools.web.Viewer <host> <port> class [args ...]"); }
/** * Finds the specified class. The implementation in this class * fetches the class from the http server. If the class is * either <code>java.*</code>, <code>javax.*</code>, or * <code>Viewer</code>, then it is loaded by the parent class * loader. * * <p>This method can be overridden by a subclass of * <code>Viewer</code>. */ protected Class findClass(String name) throws ClassNotFoundException { Class c = null; if (name.startsWith("java.") || name.startsWith("javax.") || name.equals("javassist.tools.web.Viewer")) c = findSystemClass(name); if (c == null) try { byte[] b = fetchClass(name); if (b != null) c = defineClass(name, b, 0, b.length); } catch (Exception e) { } return c; }
/** * Requests the class loader to load a class. */ protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) c = findClass(name); if (c == null) throw new ClassNotFoundException(name); if (resolve) resolveClass(c); return c; }
/** * Invokes main() in the class specified by <code>classname</code>. * * @param classname executed class * @param args the arguments passed to <code>main()</code>. */ public void run(String classname, String[] args) throws Throwable { Class c = loadClass(classname); try { c.getDeclaredMethod("main", new Class[] { String[].class }) .invoke(null, new Object[] { args }); } catch (java.lang.reflect.InvocationTargetException e) { throw e.getTargetException(); } }
InputStream s = con.getInputStream(); if (size <= 0) b = readStream(s); else { b = new byte[size];
/** * Invokes main() in the class specified by <code>classname</code>. * * @param classname executed class * @param args the arguments passed to <code>main()</code>. */ public void run(String classname, String[] args) throws Throwable { Class<?> c = loadClass(classname); try { c.getDeclaredMethod("main", new Class[] { String[].class }) .invoke(null, new Object[] { args }); } catch (java.lang.reflect.InvocationTargetException e) { throw e.getTargetException(); } }
InputStream s = con.getInputStream(); if (size <= 0) b = readStream(s); else { b = new byte[size];
/** * Requests the class loader to load a class. */ @Override protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class<?> c = findLoadedClass(name); if (c == null) c = findClass(name); if (c == null) throw new ClassNotFoundException(name); if (resolve) resolveClass(c); return c; }
/** * Finds the specified class. The implementation in this class * fetches the class from the http server. If the class is * either <code>java.*</code>, <code>javax.*</code>, or * <code>Viewer</code>, then it is loaded by the parent class * loader. * * <p>This method can be overridden by a subclass of * <code>Viewer</code>. */ @Override protected Class<?> findClass(String name) throws ClassNotFoundException { Class<?> c = null; if (name.startsWith("java.") || name.startsWith("javax.") || name.equals("javassist.tools.web.Viewer")) c = findSystemClass(name); if (c == null) try { byte[] b = fetchClass(name); if (b != null) c = defineClass(name, b, 0, b.length); } catch (Exception e) { } return c; }
/** * Starts a program. */ public static void main(String[] args) throws Throwable { if (args.length >= 3) { Viewer cl = new Viewer(args[0], Integer.parseInt(args[1])); String[] args2 = new String[args.length - 3]; System.arraycopy(args, 3, args2, 0, args.length - 3); cl.run(args[2], args2); } else System.err.println( "Usage: java javassist.tools.web.Viewer <host> <port> class [args ...]"); }
/** * Invokes main() in the class specified by <code>classname</code>. * * @param classname executed class * @param args the arguments passed to <code>main()</code>. */ public void run(String classname, String[] args) throws Throwable { Class c = loadClass(classname); try { c.getDeclaredMethod("main", new Class[] { String[].class }) .invoke(null, new Object[] { args }); } catch (java.lang.reflect.InvocationTargetException e) { throw e.getTargetException(); } }
InputStream s = con.getInputStream(); if (size <= 0) b = readStream(s); else { b = new byte[size];
/** * Requests the class loader to load a class. */ protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) c = findClass(name); if (c == null) throw new ClassNotFoundException(name); if (resolve) resolveClass(c); return c; }
/** * Finds the specified class. The implementation in this class * fetches the class from the http server. If the class is * either <code>java.*</code>, <code>javax.*</code>, or * <code>Viewer</code>, then it is loaded by the parent class * loader. * * <p>This method can be overridden by a subclass of * <code>Viewer</code>. */ protected Class findClass(String name) throws ClassNotFoundException { Class c = null; if (name.startsWith("java.") || name.startsWith("javax.") || name.equals("javassist.tools.web.Viewer")) c = findSystemClass(name); if (c == null) try { byte[] b = fetchClass(name); if (b != null) c = defineClass(name, b, 0, b.length); } catch (Exception e) { } return c; }
/** * Starts a program. */ public static void main(String[] args) throws Throwable { if (args.length >= 3) { Viewer cl = new Viewer(args[0], Integer.parseInt(args[1])); String[] args2 = new String[args.length - 3]; System.arraycopy(args, 3, args2, 0, args.length - 3); cl.run(args[2], args2); } else System.err.println( "Usage: java javassist.tools.web.Viewer <host> <port> class [args ...]"); }
/** * Invokes main() in the class specified by <code>classname</code>. * * @param classname executed class * @param args the arguments passed to <code>main()</code>. */ public void run(String classname, String[] args) throws Throwable { Class c = loadClass(classname); try { c.getDeclaredMethod("main", new Class[] { String[].class }) .invoke(null, new Object[] { args }); } catch (java.lang.reflect.InvocationTargetException e) { throw e.getTargetException(); } }
InputStream s = con.getInputStream(); if (size <= 0) b = readStream(s); else { b = new byte[size];
/** * Requests the class loader to load a class. */ protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) c = findClass(name); if (c == null) throw new ClassNotFoundException(name); if (resolve) resolveClass(c); return c; }
/** * Finds the specified class. The implementation in this class * fetches the class from the http server. If the class is * either <code>java.*</code>, <code>javax.*</code>, or * <code>Viewer</code>, then it is loaded by the parent class * loader. * * <p>This method can be overridden by a subclass of * <code>Viewer</code>. */ protected Class findClass(String name) throws ClassNotFoundException { Class c = null; if (name.startsWith("java.") || name.startsWith("javax.") || name.equals("javassist.tools.web.Viewer")) c = findSystemClass(name); if (c == null) try { byte[] b = fetchClass(name); if (b != null) c = defineClass(name, b, 0, b.length); } catch (Exception e) { } return c; }
/** * Starts a program. */ public static void main(String[] args) throws Throwable { if (args.length >= 3) { Viewer cl = new Viewer(args[0], Integer.parseInt(args[1])); String[] args2 = new String[args.length - 3]; System.arraycopy(args, 3, args2, 0, args.length - 3); cl.run(args[2], args2); } else System.err.println( "Usage: java javassist.tools.web.Viewer <host> <port> class [args ...]"); }