Confused as to why I get duplicate class error for the following code?
/*
* To change this template, choose Tools | Templates
* and open the template in th
This can also happen if the package name does not match the folder name, or if the package name is omitted. Check the package statement in your source.
If the file name doesn't match the class name, NetBeans 8.0.1 will report this as a duplicate class.
This also happens if your referencing the erroring class in a separate file in the same package, with the erroring class with an unmatching package path to the file where you are referencing erroring class.
For example file 1 some.incorrect.path.package
class_that_is_erroring{ }
file 2 some.correct.path.package
class new_class{
class_that_is_erroring myclass = null;
}
The package paths in both files must match each other and match the file system directory.
This is a known issue with netbeans BUG 226360
it might help to clear Netbeans cache:
Go to Help
-> About
and you will see
Cache directory: Path\to\Directory
Close NetBeans, go to specified directory and delete everything.
this might be due to 2 classes with the same name in the same package