Imports in the Interactions Pane

Auto-Import. When you use a class name in the Interactions Pane that is not yet known, probably because the class or its package have not been imported yet, DrJava displays an error:

Welcome to DrJava.  Working directory is /Users/Shared/drjava
> File f
Static Error: Undefined class 'File'

At this time, DrJava will open a predictive input dialog populated with all Java API classes. The initial suggestion is a class that matches the unknown class as closely as possible. After choosing the desired class, DrJava will import that class and re-execute the line that caused the error:

Welcome to DrJava.  Working directory is /Users/Shared/drjava
> File f
Static Error: Undefined class 'File'
> import java.io.File; // auto-import
File f
> 

In the predictive input dialog, there is also a checkbox that allows you to import the entire package that contains the selected class, e.g. java.io.* instead of just java.io.File:

Welcome to DrJava.  Working directory is /Users/Shared/drjava
> File f
Static Error: Undefined class 'File'
> import java.io.*; // auto-import
File f
> 

Default Imports. In DrJava's preferences under "Miscellaneous", the user can add or remove classes and packages that the user would like to automatically import in the Interactions Pane whenver the pane has been reset. After the Interactions Pane has been reset, these classes and packages are immediately available.