How to read script file from .jar package

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to read script file from .jar package

Ke Deng
Hi,all:
  My scripts file are packaged into .jar file,how to load script with the source() method in this case? I tried with the following method but not success.
  URL url = getClass().getResource("/org/laniqi/test.script");
  Interpreter i = new Interpreter();
  try{
   i.source( url.getFile() );
  }catch(EvalError e1){
     ... ...
 }
   Is there any methods to resolve this problem? If the source method can accept URL params, that will be great!
 
Thanks,
Karl.



Yahoo! Personals
Single? There's someone we'd like you to meet.
Lots of someones, actually. Yahoo! Personals
Reply | Threaded
Open this post in threaded view
|

Re: How to read script file from .jar package

patniemeyer

On Dec 5, 2005, at 8:33 PM, Ke Deng wrote:

> Hi,all:
>   My scripts file are packaged into .jar file,how to load script  
> with the source() method in this case? I tried with the following  
> method but not success.
>   URL url = getClass().getResource("/org/laniqi/test.script");
>   Interpreter i = new Interpreter();
>   try{
>    i.source( url.getFile() );
>   }catch(EvalError e1){
>      ... ...
>  }
>    Is there any methods to resolve this problem? If the source  
> method can accept URL params, that will be great!

Hi,

The the eval() method is the same as source() but you can give it a  
Reader.


Pat


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users