It's Sun proprietary code, but URLClassLoader isn't and it appears as
though you'd only need to override `findClass(String)' by iterating
over URLs given in `getURLs()' and then loading the classes with
JarInputStream.  This inherits from FileInputStream which has the
close() method you'd call.

I confirmed the used beanshell class loader uses it, but this is under
OSX.  I would be surprised if a Sun JVM under windows is different:

bsh % 
java.net.URLClassLoader.class.isAssignableFrom(this.getClass().getClassLoader().getClass());
<true>

bsh % print(this.getClass().getClassLoader().getURLs());
java.net.URL []: {
file:/Users/<USERNAME>/opt/lib/java/bsh-2.0b4/lib/bsh-2.0b4.jar,
file:/Users/<USERNAME>/opt/lib/emacs/jde-2.3.5/java/bsh-commands/,
file:/Users/<USERNAME>/opt/lib/emacs/jde-2.3.5/java/lib/checkstyle-all.jar,
file:/Users/<USERNAME>/opt/lib/emacs/jde-2.3.5/java/lib/jakarta-regexp.jar,
file:/Users/<USERNAME>/opt/lib/emacs/jde-2.3.5/java/lib/jde.jar,
file:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar,
...

Matthew Wyatt writes:
 > Paul,
 >    I couldn't find any JVM parameters that dealt with the behavior you
 > described, and writing a class loader is way more effort than I'm willing to
 > expend for this small annoyance.  I took your advice to use the directory
 > where the class files were, rather than the jar file, and that worked like a
 > charm.  Thanks,
 > -Matt
 > PS I guess I was thinking there would be some sort of exposed API (whether
 > in bsh or jdee) that would allow you to, in effect, call close() on the
 > stream attached to the file.  Does anyone know of such a thing?  (Feel free
 > to point me to documentation.)
 > PPS I don't believe I put that link in my first email; I think gmail thought
 > that was an ip address, and linked automatically.  Thanks for making me look
 > like a prat, google!
 > 
 > On Thu, Aug 28, 2008 at 5:33 PM, Paul Landes <[EMAIL PROTECTED]> wrote:
 > 
 > > I don't have the answer, but I think I might be able to narrow it
 > > down, which is the JVM.  Look to see if there are some JVM parameters
 > > you can pass so that once the classloader loads what it needs from the
 > > jar, it closes the file.
 > >
 > > As you probably know, windows uses pessimistic locking so the kernel
 > > doesn't let you do much with the file (depending on how it is opened).
 > >
 > > You might want to build classes in a directory structure instead and
 > > use that directory as a classpath element.  You might get better
 > > results.
 > >
 > > You could of course write or extend a class loader and then put it in
 > > the prebootclasspath, but I'd try building classes in a directory
 > > first (i.e. javac -d <DIR_A> ..., then java -classpath DIR_A;path...)
 > >
 > >
 > >
 > > Matthew Wyatt writes:
 > >  > All,
 > >  >    I've noticed that if I use JDEE to complete a method name, I can no
 > >  > longer delete the jar file that the BeanShell uses to look up the method
 > >  > names and signatures until I kill the process in the *JDEE bsh* buffer,
 > >  > because the BeanShell is holding onto the file handle.  Is there a way
 > > to
 > >  > force it to let go of the file after completing?
 > >  >    I'm running on Win XP, SP 2, Emacs 22.2, JDE 2.3.5.1.
 > >  >    If this is a known BeanShell issue, then I'm sorry to bring it up in
 > > this
 > >  > mailing list.  I couldn't find anything on this issue on google.
 > >  >    Thanks for your time,
 > >  > -Matt
 > >  > <div dir="ltr">All,<br>&nbsp;&nbsp; I&#39;ve noticed that if I use JDEE
 > > to complete a method name, I can no longer delete the jar file that the
 > > BeanShell uses to look up the method names and signatures until I kill the
 > > process in the *JDEE bsh* buffer, because the BeanShell is holding onto the
 > > file handle.&nbsp; Is there a way to force it to let go of the file after
 > > completing?<br>
 > >  > &nbsp;&nbsp; I&#39;m running on Win XP, SP 2, Emacs 22.2, JDE <a href="
 > > http://2.3.5.1";>2.3.5.1</a>.<br>&nbsp;&nbsp; If this is a known BeanShell
 > > issue, then I&#39;m sorry to bring it up in this mailing list.&nbsp; I
 > > couldn&#39;t find anything on this issue on google.<br>
 > >  > &nbsp;&nbsp; Thanks for your time,<br>-Matt<br></div>
 > >  >
 > > -------------------------------------------------------------------------
 > >  > This SF.Net email is sponsored by the Moblin Your Move Developer's
 > > challenge
 > >  > Build the coolest Linux based applications with Moblin SDK & win great
 > > prizes
 > >  > Grand prize is a trip for two to an Open Source event anywhere in the
 > > world
 > >  >
 > > http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
 > >  > jdee-users mailing list
 > >  > [email protected]
 > >  > https://lists.sourceforge.net/lists/listinfo/jdee-users
 > >
 > >
 > > --
 > > Paul Landes
 > > [EMAIL PROTECTED]
 > >
 > <div dir="ltr">Paul,<br>&nbsp;&nbsp; I couldn&#39;t find any JVM parameters 
 > that dealt with the behavior you described, and writing a class loader is 
 > way more effort than I&#39;m willing to expend for this small 
 > annoyance.&nbsp; I took your advice to use the directory where the class 
 > files were, rather than the jar file, and that worked like a charm.&nbsp; 
 > Thanks,<br>
 > -Matt<br>PS I guess I was thinking there would be some sort of exposed API 
 > (whether in bsh or jdee) that would allow you to, in effect, call close() on 
 > the stream attached to the file.&nbsp; Does anyone know of such a 
 > thing?&nbsp; (Feel free to point me to documentation.)<br>
 > PPS I don&#39;t believe I put that link in my first email; I think gmail 
 > thought that was an ip address, and linked automatically.&nbsp; Thanks for 
 > making me look like a prat, google!<br><br><div class="gmail_quote">On Thu, 
 > Aug 28, 2008 at 5:33 PM, Paul Landes <span dir="ltr">&lt;<a 
 > href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>&gt;</span> wrote:<br>
 > <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 
 > 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I don&#39;t have the 
 > answer, but I think I might be able to narrow it<br>
 > down, which is the JVM. &nbsp;Look to see if there are some JVM 
 > parameters<br>
 > you can pass so that once the classloader loads what it needs from the<br>
 > jar, it closes the file.<br>
 > <br>
 > As you probably know, windows uses pessimistic locking so the kernel<br>
 > doesn&#39;t let you do much with the file (depending on how it is 
 > opened).<br>
 > <br>
 > You might want to build classes in a directory structure instead and<br>
 > use that directory as a classpath element. &nbsp;You might get better<br>
 > results.<br>
 > <br>
 > You could of course write or extend a class loader and then put it in<br>
 > the prebootclasspath, but I&#39;d try building classes in a directory<br>
 > first (i.e. javac -d &lt;DIR_A&gt; ..., then java -classpath 
 > DIR_A;path...)<br>
 > <div><div></div><div class="Wj3C7c"><br>
 > <br>
 > <br>
 > Matthew Wyatt writes:<br>
 > &nbsp;&gt; All,<br>
 > &nbsp;&gt; &nbsp; &nbsp;I&#39;ve noticed that if I use JDEE to complete a 
 > method name, I can no<br>
 > &nbsp;&gt; longer delete the jar file that the BeanShell uses to look up the 
 > method<br>
 > &nbsp;&gt; names and signatures until I kill the process in the *JDEE bsh* 
 > buffer,<br>
 > &nbsp;&gt; because the BeanShell is holding onto the file handle. &nbsp;Is 
 > there a way to<br>
 > &nbsp;&gt; force it to let go of the file after completing?<br>
 > &nbsp;&gt; &nbsp; &nbsp;I&#39;m running on Win XP, SP 2, Emacs 22.2, JDE <a 
 > href="http://2.3.5.1"; target="_blank">2.3.5.1</a>.<br>
 > &nbsp;&gt; &nbsp; &nbsp;If this is a known BeanShell issue, then I&#39;m 
 > sorry to bring it up in this<br>
 > &nbsp;&gt; mailing list. &nbsp;I couldn&#39;t find anything on this issue on 
 > google.<br>
 > &nbsp;&gt; &nbsp; &nbsp;Thanks for your time,<br>
 > &nbsp;&gt; -Matt<br>
 > </div></div>&nbsp;&gt; &lt;div 
 > dir=&quot;ltr&quot;&gt;All,&lt;br&gt;&amp;nbsp;&amp;nbsp; I&amp;#39;ve 
 > noticed that if I use JDEE to complete a method name, I can no longer delete 
 > the jar file that the BeanShell uses to look up the method names and 
 > signatures until I kill the process in the *JDEE bsh* buffer, because the 
 > BeanShell is holding onto the file handle.&amp;nbsp; Is there a way to force 
 > it to let go of the file after completing?&lt;br&gt;<br>
 > 
 > &nbsp;&gt; &amp;nbsp;&amp;nbsp; I&amp;#39;m running on Win XP, SP 2, Emacs 
 > 22.2, JDE &lt;a href=&quot;<a href="http://2.3.5.1"; 
 > target="_blank">http://2.3.5.1</a>&quot;&gt;<a href="http://2.3.5.1"; 
 > target="_blank">2.3.5.1</a>&lt;/a&gt;.&lt;br&gt;&amp;nbsp;&amp;nbsp; If this 
 > is a known BeanShell issue, then I&amp;#39;m sorry to bring it up in this 
 > mailing list.&amp;nbsp; I couldn&amp;#39;t find anything on this issue on 
 > google.&lt;br&gt;<br>
 > 
 > &nbsp;&gt; &amp;nbsp;&amp;nbsp; Thanks for your 
 > time,&lt;br&gt;-Matt&lt;br&gt;&lt;/div&gt;<br>
 > &nbsp;&gt; 
 > -------------------------------------------------------------------------<br>
 > &nbsp;&gt; This SF.Net email is sponsored by the Moblin Your Move 
 > Developer&#39;s challenge<br>
 > &nbsp;&gt; Build the coolest Linux based applications with Moblin SDK &amp; 
 > win great prizes<br>
 > &nbsp;&gt; Grand prize is a trip for two to an Open Source event anywhere in 
 > the world<br>
 > &nbsp;&gt; <a 
 > href="http://moblin-contest.org/redirect.php?banner_id=100&amp;url=/_______________________________________________";
 >  
 > target="_blank">http://moblin-contest.org/redirect.php?banner_id=100&amp;url=/_______________________________________________</a><br>
 > 
 > &nbsp;&gt; jdee-users mailing list<br>
 > &nbsp;&gt; <a 
 > href="mailto:[email protected]";>[email protected]</a><br>
 > &nbsp;&gt; <a href="https://lists.sourceforge.net/lists/listinfo/jdee-users"; 
 > target="_blank">https://lists.sourceforge.net/lists/listinfo/jdee-users</a><br>
 > <font color="#888888"><br>
 > <br>
 > --<br>
 > Paul Landes<br>
 > <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a><br>
 > </font></blockquote></div><br></div>
 > -------------------------------------------------------------------------
 > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
 > Build the coolest Linux based applications with Moblin SDK & win great prizes
 > Grand prize is a trip for two to an Open Source event anywhere in the world
 > http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
 > jdee-users mailing list
 > [email protected]
 > https://lists.sourceforge.net/lists/listinfo/jdee-users


-- 
Paul Landes
[EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jdee-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jdee-users

Reply via email to