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

Summary: code compiles even when the package name wrong
Product: ide Reporter: shche123 <shche123>
Component: CodeAssignee: issues@ide <issues>
Status: RESOLVED DUPLICATE    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:

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:

run:
java.lang.NoClassDefFoundError: test/TestClass (wrong name: Test/TestClass)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
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 ***