How Do You Troubleshoot the Java Compilation Error “cannot find symbol”?

Problem scenario
You try to compile a Java program with a javac command. You get this error:

special.java:39: error: cannot find symbol
symbol: class foo
location: class bar

What should you do?

Possible solution
In some cases you need a keyword "new", but in other cases you need to not have the keyword "new".

Are you using the word "new" to the right of an equals sign "="? For example, does the offending line in your Java program look like this?

String [][] var1 = new foo();

Try eliminating the keyword "new". Then see if it compiles. There are many potential causes. To read more, see this website or see this page.

Leave a comment

Your email address will not be published. Required fields are marked *