Return-Path: Delivered-To: apmail-jakarta-ant-user-archive@jakarta.apache.org Received: (qmail 3364 invoked by uid 500); 22 Mar 2001 23:54:08 -0000 Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: ant-user@jakarta.apache.org Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 3353 invoked from network); 22 Mar 2001 23:54:07 -0000 Content-Type: text/plain; charset="iso-8859-1" From: Matthew Cooper To: ant-user@jakarta.apache.org Subject: JUnit task : getResourceAsStream problems Date: Fri, 23 Mar 2001 10:47:30 +1100 X-Mailer: KMail [version 1.2] MIME-Version: 1.0 Message-Id: <01032310473002.07500@laalaa.syd.cognoworks.com> Content-Transfer-Encoding: 8bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N I am using ant 1.3 junit 3.5 and sun jdk 1.3 for linux. If i use the junit task to run a test under ant, the code cannot load the resource I specify - I just get null returned from ... System.out.println("System classloader"); System.out.println(ClassLoader.getSystemResourceAsStream(RESOURCE_NAME)); ...or... ClassLoader classLoader = Thread.currentThread() .getContextClassLoader(); System.out.println(" classloader="+classLoader); System.out.println(classLoader.getResourceAsStream(RESOURCE_NAME)); If i run the unit test from the command line with something like... java -cp ../build/classes:../build/test/classes/:lib/junit.jar...etc... junit.textui.TestRunner MyTest then the system classloader works and finds the resource (although I cannot get the current Thread's class loader to work). In case its relevant, I am trying to load the resource in a static code that gets run when my class loads. Can anyone help??? Thanks, Matty.