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

后端 未结 12 822
余生分开走
余生分开走 2020-11-27 04:37

I get this error when I compile my java program:

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


        
12条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 05:03

    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.

提交回复
热议问题