Changing the Classpath

Within BeanShell, you can add to your classpath and even reload classes:

    addClassPath("mystuff.jar");
    addClassPath("http://examples.oreilly.com/learnjava3/magicbeans.jar");

To reload all classes in the classpath, simply use:

    reloadClasses();

You can do more elaborate things as well, such as reloading individual classes, if you know what you’re doing. See the user manual for more details.

Get Learning Java, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.