devxlogo

Using Error: Class Names and YourClassName

Using Error: Class Names and YourClassName

Using error: Class names, 'YourClassName', is only accepted if annotation processing is explicitly requested.

There are likely instances that you have come across this error and found it very difficult to understand what is happening.

Even experienced engineers face such issues and are unable to move on. This sometimes happens when you are not using your IDE for work.

The reason why this error occurs is really simple.

The reason is that you are trying to use the javac command with a file name without the java extension.

For example:

javac YourClassName - This command will result in the above error. By mistake, you have used javac to execute.

Correct way of using the commands:

-----------------------------------------------------------javac YourClassName.java - This is the correct way of using this command to compile. java YourClassName - This is the correct way of using this commad to execute.
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist