Skip to content
Advertisement

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

I get this error when I compile my java program:

JavaScript

Here is the java code (I’m running this on Ubuntu).

JavaScript

Here is the javac command:

JavaScript

How do I compile this program?

Advertisement

Answer

You at least need to add the .java extension to the file name in this line:

JavaScript

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.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement