This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 166307 - code compiles even when the package name wrong
Summary: code compiles even when the package name wrong
Status: RESOLVED DUPLICATE of bug 146168
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker (vote)
Assignee: issues@ide
Depends on:
Reported: 2009-05-31 20:09 UTC by shche123
Modified: 2009-06-08 11:20 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description shche123 2009-05-31 20:09:49 UTC
code compiles even when the package name wrong

The package name is 'test' and appears in the source code as 'Test'.

The file compiles and when it runs, produces:

java.lang.NoClassDefFoundError: test/TestClass (wrong name: Test/TestClass)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(
        at Method)
        at java.lang.ClassLoader.loadClass(
        at sun.misc.Launcher$AppClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        at java.lang.ClassLoader.loadClassInternal(
Could not find the main class: test.TestClass.  Program will exit.
Exception in thread "main" 
Exception in thread "main" Java Result: 1

package Test;

class Coffee {

    enum EnumClass {

        ONE, TWO, THREE
    public EnumClass attribute;

public class TestClass {

    public static void main(String[] args) {
Comment 1 Jiri Prox 2009-06-08 11:20:57 UTC
This is already reported as issue 146168. Thanks for your report anyway

*** This issue has been marked as a duplicate of 146168 ***