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.

2 comments:

Anonymous said...

Looks like I'm about 8 years too late haha... Just wanted to say that this helped me fix an error. Thanks for posting!

Akash Verma said...

Haha I am late too!
But yes thanks.