Java Beans Question: Download Java Beans PDF

Why do I get a duplicate name error when loading a JAR file?

Tweet Share WhatsApp

Answer:

The most common reason for a "java.lang.ClassFormatError: Duplicate name" error is that a .class file in the JAR contains a class whose class name is different from the expected name. So for example if you have a file called "a/B.class" and it contains a class called "B" or "a.X" instead of the class "a.B" then you will get this error.

Themost common causes for this problem are either forgetting to include a "package a;" statement or having a "package" statement with the wrong name.

Download Java Beans PDF Read All 57 Java Beans Questions
Previous QuestionNext Question
What is the relationship between Sun s JFCs and JavaBeans?What are the security implications for downloading Beans over the Internet?