Class Viewer

java.lang.Object
java.lang.ClassLoader
javassist.tools.web.Viewer

public class Viewer extends ClassLoader
A sample applet viewer.

This is a sort of applet viewer that can run any program even if the main class is not a subclass of Applet. This viewwer first calls main() in the main class.

To run, you should type:

% java javassist.tools.web.Viewer host port Main arg1, ...

This command calls Main.main() with arg1,... All classes including Main are fetched from a server http://host:port. Only the class file for Viewer must exist on a local file system at the client side; even other javassist.* classes are not needed at the client side. Viewer uses only Java core API classes.

Note: since a Viewer object is a class loader, a program loaded by this object can call a method in Viewer. For example, you can write something like this:

 Viewer v = (Viewer)this.getClass().getClassLoader();
 String port = v.getPort();
 
  • Field Details

    • server

      private String server
    • port

      private int port
  • Constructor Details

    • Viewer

      public Viewer(String host, int p)
      Constructs a viewer.
      Parameters:
      host - server name
      p - port number
  • Method Details