Re: Class loading
David <[email protected]> Thu, 19 Aug 2010 09:26:01 -0400
| Newsgroups | gmane.comp.java.beanshell.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============7578691748769021148== Content-Type: multipart/alternative; boundary="------------070504010407020409010004" This is a multi-part message in MIME format. --------------070504010407020409010004 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit If you want programming help to accomplish the same thing, you should look at the Class and ClassLoader API reference. This is the underlying glue that lets you adjust the class path and dynamically locate and load classes. I warn, however, that if your project is in such a rush that you may find the complexity of getting these API's is high. I consider mucking with ClassLoader "Advanced" Java programming and it takes quite a while to learn it and get it to work right. You may not be pleased if you expect to get an implementation to work "urgently". -David On 8/19/2010 9:21 AM, Alexey Zinger wrote: > If I'm not mistaken, BeanShell simply pre-imports certain packages > (java.lang.*, java.util.*, java.io.*?). > Alexey > http://azinger.blogspot.com > http://bsheet.sourceforge.net > http://wcollage.sourceforge.net > > > ------------------------------------------------------------------------ > *From:* "[email protected]" <[email protected]> > *To:* beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > *Sent:* Thu, August 19, 2010 12:35:56 AM > *Subject:* [Beanshell-dev] Class loading > > > Hei, > > Interpreter i = *new* Interpreter(); > i.eval("String s = new String(\"Hello World!\");"); > > In the above Java statement i wish to know how the beanshell invokes > the class "String" without its package being specified. How does it > associates the namespace. > > I have a small requirement like this, to dynamically invoke simple > Java statements and invoke Java classes dynamically. I have a small > interpreter developed for this. As the requirement is urgent, although > i had read few sources of beanshell i would like to get the answer > from the experienced than by finding all my myself. > > Thanks > > V > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > > > _______________________________________________ > Beanshell-developers mailing list > Beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/beanshell-developers -- David A. Lee [email protected] http://www.xmlsh.org --------------070504010407020409010004 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> If you want programming help to accomplish the same thing, you should look at the Class and ClassLoader API reference.<br> This is the underlying glue that lets you adjust the class path and dynamically locate and load classes.<br> <br> I warn, however, that if your project is in such a rush that you may find the complexity of getting these API's is high.<br> I consider mucking with ClassLoader "Advanced" Java programming and it takes quite a while to learn it and get it to work right.<br> You may not be pleased if you expect to get an implementation to work "urgently".<br> <br> -David<br> <br> <br> <br> <br> <br> On 8/19/2010 9:21 AM, Alexey Zinger wrote: <blockquote cite="mid:971469.37421.qm-mZnzRdpZQtmB9c0Qi4KiSl5cfvJIxWXgQQ4Iyu8u01E@public.gmane.org" type="cite"> <style type="text/css"><!-- DIV {margin:0px;} --></style> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">If I'm not mistaken, BeanShell simply pre-imports certain packages (java.lang.*, java.util.*, java.io.*?).<br> <div> </div> Alexey<br> <a moz-do-not-send="true" rel="nofollow" target="_blank" href="http://azinger.blogspot.com">http://azinger.blogspot.com</a><br> <a moz-do-not-send="true" rel="nofollow" target="_blank" href="http://bsheet.sourceforge.net">http://bsheet.sourceforge.net</a><br> <a moz-do-not-send="true" rel="nofollow" target="_blank" href="http://wcollage.sourceforge.net">http://wcollage.sourceforge.net</a><br> <div><br> </div> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"> <hr size="1"><b><span style="font-weight: bold;">From:</span></b> <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">"[email protected]"</a> <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]"><[email protected]></a><br> <b><span style="font-weight: bold;">To:</span></b> <a class="moz-txt-link-abbreviated" href="mailto:beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org">beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org</a><br> <b><span style="font-weight: bold;">Sent:</span></b> Thu, August 19, 2010 12:35:56 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> [Beanshell-dev] Class loading<br> </font><br> <br> <font face="sans-serif" size="2">Hei, </font> <br> <br> <font face="Courier New" size="2">Interpreter i = </font><font color="#820040" face="Courier New" size="2"><b>new</b></font><font face="Courier New" size="2"> Interpreter();</font> <br> <font face="Courier New" size="2">i.eval(</font><font color="#4200ff" face="Courier New" size="2">"String s = new String(\"Hello World!\");"</font><font face="Courier New" size="2">);</font> <br> <br> <font face="sans-serif" size="2">In the above Java statement i wish to know how the beanshell invokes the class "String" without its package being specified. How does it associates the namespace.</font> <br> <br> <font face="sans-serif" size="2">I have a small requirement like this, to dynamically invoke simple Java statements and invoke Java classes dynamically. I have a small interpreter developed for this. As the requirement is urgent, although i had read few sources of beanshell i would like to get the answer from the experienced than by finding all my myself.</font> <br> <br> <font face="sans-serif" size="2">Thanks</font> <br> <br> <font face="sans-serif" size="2">V</font></div> </div> </div> <br> <pre wrap=""> <fieldset class="mimeAttachmentHeader"></fieldset> ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge <a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/RIM-dev2dev">http://p.sf.net/sfu/RIM-dev2dev</a> </pre> <pre wrap=""> <fieldset class="mimeAttachmentHeader"></fieldset> _______________________________________________ Beanshell-developers mailing list <a class="moz-txt-link-abbreviated" href="mailto:Beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org">Beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/beanshell-developers">https://lists.sourceforge.net/lists/listinfo/beanshell-developers</a> </pre> </blockquote> <br> <br> <pre class="moz-signature" cols="72">-- David A. Lee <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a> <a class="moz-txt-link-freetext" href="http://www.xmlsh.org">http://www.xmlsh.org</a> </pre> </body> </html> --------------070504010407020409010004-- --===============7578691748769021148== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev --===============7578691748769021148== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Beanshell-developers mailing list Beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/beanshell-developers --===============7578691748769021148==--