I get this error when I compile my java program:
error: Class names, \'EnumDevices\', are only accepted if annotation
processing is explicitly requested
1
The error "Class names are only accepted if annotation processing is explicitly requested" can be caused by one or more of the following:
This may not be the complete list of causes to this error, but these are the causes that I am aware of so far.
Using javac ClassName.java to compile the program, then use java ClassName to execute the compiled code. You can't mix javac with the ClassName only (without the java extension).
I learned that you also can get this error by storing the source file in a folder named Java
You at least need to add the .java
extension to the file name in this line:
javac -cp /home/manish.yadav/Desktop/JCuda-All-0.3.2-bin-linux-x86_64 EnumDevices
From the official faq:
Class names, 'HelloWorldApp', are only accepted if annotation processing is explicitly requested
If you receive this error, you forgot to include the .java suffix when compiling the program. Remember, the command is javac HelloWorldApp.java not javac HelloWorldApp.
Also, in your second javac-example, (in which you actually included .java
) you need to include the all required .jar-files needed for compilation.
To avoid this error, you should use javac command with .java extension.
Javac DescendingOrder.java <- this work perfectly.
If you compile multiple files in the same line, ensure that you use javac only once and not for every class file.
Incorrect:
Correct: