Twitter Updates

Thursday, 9 April 2009

Java duplicate class error

I recently created a new class and when trying to compile my new code I got this error (below) and it took some time to figure out what the duplicate class error meant.

[javac] N:\morgan\utils\FileExplorer\src\fileexplorer\TransferListItem.java: 5: duplicate class: TransferListItem
[javac] public class TransferListItem extends JPanel {

The problem was that I had missed the package decleration at the start of the file.
so by adding "package fileexplorer;" on line 1 the error went away and the code started compiling again.

No comments: