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

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