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 146168

Summary: Compile on Save uses java file location instead of package declaration
Product: java Reporter: Petr Dvorak <joshis>
Component: CompilerAssignee: Dusan Balek <dbalek>
Status: VERIFIED FIXED    
Severity: blocker CC: malfunction84
Priority: P3    
Version: 6.x   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 152191    
Attachments: sample project

Description Petr Dvorak 2008-09-04 12:38:06 UTC
Product Version: NetBeans IDE Dev (Build 200809021401)
Java: 1.6.0_10; Java HotSpot(TM) Client VM 11.0-b15
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)

COS uses a java file location instead of package declaration for execiting files...

To reproduce:

0. Start IDE
1. Open sample project from TS_60_JavaEditor and assure COS is enabled
2. Open class OpenFile.java
3. Try to run this file ("Run File" from the editor's popup menu)
-> failure:

java.lang.NoClassDefFoundError: test/OpenFile
Caused by: java.lang.ClassNotFoundException: test.OpenFile
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: test.OpenFile.  Program will exit.
Exception in thread "main" Java Result: 1

4. Disable COS for the project
5. Try to run file OpenFile.java again
-> success
Comment 1 Petr Dvorak 2008-09-04 12:38:52 UTC
Created attachment 69043 [details]
sample project
Comment 2 Jiri Prox 2009-06-08 11:20:43 UTC
*** Issue 166307 has been marked as a duplicate of this issue. ***
Comment 3 Dusan Balek 2009-09-30 09:49:44 UTC
Should be fixed in the current dev build.
Comment 4 Petr Dvorak 2009-11-02 12:34:37 UTC
Yes, it works in the 68Beta => Verified