Results 1 to 9 of 9
Thread: Duplicate Class Error Message
- 09-08-2011, 09:47 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 9
- Rep Power
- 0
Duplicate Class Error Message
I am using NetBeans for development and I am getting an error message at my main class indicating that my main class is a "Duplicate Class". I even deleted the offending class and recreated if from scratch. I still get the "Duplicate Class" error message.
I did a "clean and build" and the build is successful.
As soon as I try to run the project, a dialog pops ups saying "One or more projects were compiled with errors". Ignoring the error and running project causes it to die immediately with
"java.lang.VerifyError: (class: Census/CensusReports, method: <init> signature: ()V) Constructor must call super() or this()
Could not find the main class: Census.CensusReports. Program will exit.
Exception in thread "main" Java Result: 1"
Adding super() to the constructor does nothing. The same error as above appears.
What do I need to do to get rid of the error message?
Thanks for the help.Last edited by bruceaj; 09-08-2011 at 09:59 PM. Reason: Add more information
- 09-08-2011, 10:07 PM #2
Re: Duplicate Class Error Message
Is it possible for you to try compiling the program outside of the IDE with the javac command and see what errors ou get?
- 09-08-2011, 10:18 PM #3
Member
- Join Date
- Sep 2011
- Posts
- 9
- Rep Power
- 0
Re: Duplicate Class Error Message
I've never done that but I'll try... I did check and the javac cmd is available from a cmd prompt. I'll see what I can do.
This is going to take some time. I have a total of 6 files in the project, which includes the one that is giving me the problem. Also, I have an external library that I'll need to point to, somehow, with the javac cmd.Last edited by bruceaj; 09-08-2011 at 10:25 PM. Reason: More information
- 09-09-2011, 01:06 AM #4
Re: Duplicate Class Error Message
Do you have 2 classes with the same name? What are the 6 classes you have?
- 09-09-2011, 01:14 AM #5
Member
- Join Date
- Sep 2011
- Posts
- 9
- Rep Power
- 0
Re: Duplicate Class Error Message
I haven't been able to figure how to tell the compiler where my common Library is. I cd to the directory above my source code and issue: javac Code\*.java and that complies my base code, but I do have errors because it doesn't know where my own common Library is.
Suggestions on how to use the javac command. I keep Googling. Maybe I'll find what I need. I'm sure it must be out there somewhere.
Thanks...
Bruce
- 09-09-2011, 02:37 AM #6
Re: Duplicate Class Error Message
Look at using the -classpath option to point to the needed jar files
- 09-09-2011, 04:23 PM #7
Member
- Join Date
- Sep 2011
- Posts
- 9
- Rep Power
- 0
Re: Duplicate Class Error Message
Looking under the NetBeans "Files", I find
Census1930.class
Census1920.class
Census1910.class
Census1900.class
Census1880.class
CensusReports.class
In the source code, CensusReports.class is the one that NetBeans had flagged as duplicate.
In searching the code, I have not been able to find another CensusReport.class. The project is small enough that I should be able to find any duplicate class. I suspect that NetBeans has some residual stuff somewhere that needs to be deleted but I'm fairly new to NetBeans/Java and not sure what I can manually delete safely.
I removed CensusReports.class from the project and did a clean/build. Compile errors reported that it couldn't find CenusReports.
I created a NEW CensusReports.class and the message "duplicate class: Census.CensusReports" came back.Last edited by bruceaj; 09-09-2011 at 04:47 PM. Reason: Add additional information
- 09-09-2011, 06:49 PM #8
Member
- Join Date
- Sep 2011
- Posts
- 9
- Rep Power
- 0
Re: Duplicate Class Error Message
Still haven't figured out where the duplicate class problem is but I created a completely new project and copied all my classes into it, included the class that gave me the error message.
Guess what. All is good. The new project compiles and runs with NOT errors.
So, I'm guessing it's some sort of bug in NetBeans that left some residual stuff around. With the new project running, I "MIGHT" take the time to delete files from the original and see if I can find the culprit.
Thanks to all with the suggestions..
Bruce
- 11-05-2011, 11:50 AM #9
Member
- Join Date
- Nov 2011
- Posts
- 1
- Rep Power
- 0
Similar Threads
-
Duplicate class error
By hamedy in forum NetBeansReplies: 7Last Post: 06-28-2012, 05:02 PM -
keep getting error message class, interface, or enum expected
By darr in forum New To JavaReplies: 2Last Post: 10-02-2010, 02:13 AM -
Semantic Error: Message not understood by class
By JVassie in forum New To JavaReplies: 5Last Post: 04-15-2010, 02:39 PM -
Semantic error: Message incrementMedalCount() not understood by class'OlympicFrog'
By darkblue24 in forum New To JavaReplies: 1Last Post: 02-15-2010, 10:32 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks