java.lang.NoClassDefFoundError - better error message for package problems

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Not an Issue
    • Priority: P5
    • None
    • Affects Version/s: 1.4.2
    • Component/s: hotspot
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      I just stumbled across yet another java.lang.NoClassDefFoundError question at the JDC:

      java.lang.NoClassDefFoundError: Test (wrong name: package/Test)

      If one knows what's going on, this is enough to tell that the package name was omitted and the error makes a suggestion. But the text for the suggestion is a little misleading, especially for beginners that are most likely to stumble across it. Even I still get confused about it from time to time.

      The text in the parenthesis implies that "package/Test" is the wrong name, but actually, it's the correct one, and loading the class just using "Test" was wrong.

      JUSTIFICATION :
      I think especially beginners will benefit from getting a more helpful error message.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      An error message similar to
      java.lang.NoClassDefFoundError: Test (Did you mean package.Test? Use fully qualified class names.)
      would be more helpful to finding not only the cause of the problem, but also a solution.
      ACTUAL -
      Produces a confusing error message:
      java.lang.NoClassDefFoundError: Test (wrong name: package/Test)

      So is Test incorrect, or package/Test? It's not easy to tell given this text. It actually (wrongly) emphasizes that package/Test would be the problematic name.

      ---------- BEGIN SOURCE ----------
      Text resource - no source code necessary.
      ---------- END SOURCE ----------

            Assignee:
            Ioi Lam
            Reporter:
            Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: