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 61400 - classloader & library support problem
Summary: classloader & library support problem
Status: RESOLVED INVALID
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: Other Windows XP
: P1 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-26 11:11 UTC by goko
Modified: 2005-09-05 10:01 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
netbeans project & bugLib directory (16.35 KB, application/x-compressed)
2005-07-26 11:14 UTC, goko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description goko 2005-07-26 11:11:17 UTC
Product Version       = NetBeans IDE 4.1 (Build 200505031930)
  Operating System      = Windows XP version 5.1 running on x86
  Java; VM; Vendor      = 1.5.0_03; Java HotSpot(TM) Client VM 1.5.0_03-b07; Sun
Microsystems Inc.
  Java Home             = C:\Program Files\Java\jdk1.5.0_03\jre
  System Locale; Encod. = sl_SI (nb); Cp1250

observed behavior:
classloader doesn't load classes in right order

expected behavior:
classloader should load classes from build directory first before loading from
library

exact steps to reproduce the problem:
1. new project Java Main class: test.bug.Main
2. create Java Class bug.report.Henry
3. create Java Class bug.report.Peter extends Henry
4. compile both java classes
5. make dir bugLib and copy classes and src from project into dir
6. make library to bugLib
7. refactor class Henry ... add private class member private String surname =
"Fonda";
8. refactor class Henry ... ad protected method protected String getSurname() {
return surname; }
9. create Java Class bug.report.Bridget extends Peter
10. add public method in Bridget class:
  public void tellSomething() {
    System.out.println("my grandpa was "+getSurname());
  }

11. refactor class test.bug.Main main method: 
  public static void main(String[] args) {
    Bridget bridget = new Bridget();
    bridget.tellSomething();
  }

11. when i run project i get:
Exception in thread "main" java.lang.NoSuchMethodError:
bug.report.Bridget.getSurname()Ljava/lang/String;

But when I run from MS-DOS command program executes properly:
java -cp D:\javaFiles\bug\build\classes;D:\bugLib\classes test.bug.Main
my grandpa was Fonda
Comment 1 goko 2005-07-26 11:14:48 UTC
Created attachment 23287 [details]
netbeans project & bugLib directory
Comment 2 Martin Matula 2005-07-26 11:38:37 UTC
Seems like a java/j2seproject issue. Reassigning...
Comment 3 Tomas Zezula 2005-07-26 13:39:05 UTC
The classpath is passed in the same order as specified in project customizer.
But it is good practise to have libraries before the dist.jar. But if you need
to override classes in the library you can change the order in the project's
customizer.