Loading External Classes Dynamically

The VisualAge for Java IDE lets you run code that refers to classes that are external to the IDE (that is, they have not been imported to the workspace, but rather exist only on the file system).  These could be .class files or classes in a Jar or Zip file.   They could also be applets on an HTML page on a web server.  The classes will be loaded when the program that calls them runs.  Use the forName("Package.ClassName") method in java.lang.Class to load and link external classes at run time.

To allow the workspace to compile and run code that uses external classes, you must specify the file system path to the external classes or the Jar or Zip file that contains them.  This setting is done in one of the following places:

tentergf.gif (577 bytes) Warning:   Class path settings for a program are saved in the repository if you enable the Save in repository (as default) checkbox in the Properties notebook.  However, the setting may include paths that are workstation-specific (local drives that might not exist on team-members workstations), or operating system-specific (file system notations are different on different systems).  Exercise caution when you click Defaults in the Properties notebook, because this resets the class path setting to what is saved as default in the repository; the resulting class path may be incompatible with your system.   Especially beware of paths in the Extra directories path field.

Debugging External Classes
The debugger settings include a class source path, in which you can set the path to source code for the external classes used by your application.  This allows you to step into methods in external classes when you debug.  Set the debug source path on the Debugging page of the Options dialog.

ngrelc.gif (533 bytes)
Development Without Files

ngrelt.gif (466 bytes)
Setting the Class Path
Importing Files from the File System
Setting IDE Options
Setting Breakpoints in External Classes
Setting Debugger Options