I have come across this issue many times in the forums.  I found in most cases the "cannot find symbol" error is mostly due to missing libraries. The first step is always to check if you have the required libraries added to your classpath.  To add a Jar file, expand your project, right click on the libraries nodes. Select the option to Add Library or Add Jar.  You can also do this by right clicking on the Project node -> Properties.

Another tip is to make sure you have checked all your import statements. The NetBeans IDE provides the Fix Import feature. Right click in the java source file to bring up the context sensitive menu and select "Fix Imports". You can also do this using the short cut  "CTRL+Shift+I"

The section on Managing a Project's Classpath  in the Using NetBeans  guide is a very good reference for understanding how to setup your projects classpath. For new NetBeans users I would also recommend Introduction to Developing General Java Applications tutorial

Comments:

Thanks, I have been getting cannot find symbol compile errors in my programs. I took the advice posted here and it works.

Posted by David on December 05, 2008 at 07:29 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by radhika