20120603_1039

  1. References
    1. Post by JimmyD @ http://www.java-forums.org
    2. http://stackoverflow.com/questions/6428992/how-to-avoid-duplicate-class-in-java
  2. Steps to replicate
    1. Create ~/hands_on/java dir.
    2. Put these two files, HelloWorld and Class2, under the above dir.
    3. % javac Class2.java HelloWorld.java
      1. ...
      2. .\Class2.java:3: error: duplicate class: org.mysite.Class2
      3. ...
  3. Comments
    1. HelloWorld.java and Class2.java reside in the same dir, and thus, are expected to belong to the same package. Either removing "package org.mysite;" from Class2.java or adding it to HelloWorld.java would fix this error.
    2. However, the error message is misleading. The Java compiler, javac, should fix that.
Comments