Results 1 to 8 of 8
Thread: Error message about class name
- 03-06-2013, 05:23 PM #1
Member
- Join Date
- Jan 2013
- Location
- London
- Posts
- 7
- Rep Power
- 0
Error message about class name
When I try and compile some of my java files I get the error message below (I use mac but I believe it does not really matter):
error: Class names, 'WhileDemo', are only accepted if annotation processing is explicitly requested
Sometimes I received this when I tried some codes from text book as well, so I think the problem is not with the code. Can anybody help what could be the problem? http://www.java-forums.org/images/smilies/skype/=(.gif
- 03-06-2013, 05:25 PM #2
- 03-07-2013, 08:51 AM #3
Member
- Join Date
- Jan 2013
- Location
- London
- Posts
- 7
- Rep Power
- 0
- 03-07-2013, 10:02 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: Error message about class name
OK.
So what does the file you are trying to compile look like?
ANd copy/paste the full command you are using and the full error message you receive.Please do not ask for code as refusal often offends.
- 03-08-2013, 04:01 PM #5
Member
- Join Date
- Jan 2013
- Location
- London
- Posts
- 7
- Rep Power
- 0
Re: Error message about class name
All right here is the full story from a to z:
The file is very simple and was prepared in TextEdit. It looks like:
class WhileDemo{
public static void main(String[] args){
char ch = 'a';
while (ch<='z'){
System.out.println(ch);
ch++;
}
}
}
Obviously the file was saved in a separate folder with the same name as the file and with .java extension. I tried to compile it in iTerm, which is an improved Terminal using the following command:
javac WhileDemo.java
The error message I got was:
error: Class names, 'WhileDemo', are only accepted if annotation processing is explicitly requested
1 error
Now I experienced the problem with other files as well. Some of them are very simple so I am sure it is not about the coding.Last edited by Georgino; 03-08-2013 at 04:06 PM.
- 03-08-2013, 04:29 PM #6
Godlike
- Join Date
- Nov 2012
- Posts
- 233
- Rep Power
- 1
Re: Error message about class name
Apparently you get this error when you use the javac command and not include the .java extension. I am not sure why you would get this when running javac WhileDemo.java, but maybe you typed it correctly in this forum and wrongly in your iTerm. Just my 2¢.
(Java Compile Problem: Class names are only accepted if annotation processing is explicitly requested - Stack Overflow)
- 03-08-2013, 10:56 PM #7
Member
- Join Date
- Jan 2013
- Location
- London
- Posts
- 7
- Rep Power
- 0
- 03-09-2013, 02:49 AM #8
Similar Threads
-
Duplicate Class Error Message
By bruceaj in forum New To JavaReplies: 8Last Post: 11-05-2011, 11:50 AM -
Error message "could not find the main class"
By srwpchelp in forum New To JavaReplies: 8Last Post: 12-23-2010, 09:15 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