Showing posts with label compilation error. Show all posts
Showing posts with label compilation error. Show all posts

Monday, September 30

error:Class names are only accepted if annotation processing is explicitly requested






-->

This error generally occurs when one try to compile a java file without appending .java extension in file name ..

For example

I have below class at location C:\Users\mkum\Desktop\java


public class Test{

               
                public String result() {

                                return "abc";

                }

}

On compiling this as below :

C:\Users\mkum\Desktop\java>javac Test

error: Class names, 'Test', are only accepted if annotation processing is explicitly requested
1 error








So correct way to compile class from command line would be

C:\Users\mkum\Desktop\java>javac Test.java

Now it will compile well and will generate the binary file.