Getting Intellisense (code-comlete) to work in a NetBeans “Java Application with Existing Ant Script”
By Lee Patton
Intellisense (or auto-complete, or code-completion, whatever…) wasn’t working properly in NetBeans for a free-form project (i.e., a “Java Project with Existing Ant Script”), but it was working for stand-alone applications (i.e., a “Java Application”).
When typing something like “System.” (notice the dot) in a “Java Application,” a window will pop up with an appropriate list of methods and members for the class “System”. However, in the free-form project (i.e., “Java Project with Existing Ant Script”), this does not happen. Instead, it pops-up with “no suggestions” or a list of miscellaneous words for auto-completion.
You must update the project classpath for the free-form project. You can find your classpath by examining the “Classes” tab under Tools->Java Platform Manager. My classpath is:
To update the classpath for the free-form project, right-click on the project icon in the projects view pane, and select “Properties”. NetBeans will not let you set the classpath unless you have first explicitly listed “Source Package Folders.” So, click on the “Java Sources” button in the options tree on the left-hand side. Then click the “Add Folder” button next to the “Source Package Folder” list box. Select your Java source directories. Next, click the “Java Source Classpath” button in the options tree (left-hand side again), and click the “Add JAR/Folder” button. Browse to the JAR files/folders that you saw listed in your Java Platform Manager, and select them. They should now be listed in the list box. Click OK.
Hopefully that does it.
Visit my blog at http://www.pattoncentral.org/