You cannot force garbage collection via a normal
Java API call (such as System.gc()).
However, Sun's JVM does have a debugger interface which does allow you to force garbage collection. The tool
JConsole (included with the JDK), which uses this interface, can be used to force garbage collection in running Java processes. NetBeans most likely uses the same interface to force garbage collection.
I don't know the details of how the debugger interface works.
[ June 27, 2008: Message edited by: Jesper Young ]