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
URL:
Keywords:
Depends on:
Blocks:
 
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:


Attachments

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:

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 ***