Jruby service question (BasicLibraryService)

Hi, guys
I follow the article JRuby Service in
Railshttp://blarg.slackworks.com/posts/jruby-service-in-railsby
Michael Guymon, but I can’t get through.
Even I create a very simple class:
public class SimpleService implements BasicLibraryService {
public boolean basicLoad(final Ruby runtime) throws IOException {
System.out.println(“Hello from Java service !”);
}
}

I deployed the jar into myrailsapp/lib dir, and start rails console,

load simple_service.jar and import class SimpleService. The method
“basicLoad” did not run.
Can anyone help me ?

On Wed, Aug 6, 2008 at 1:45 AM, Yin AnPing [email protected] wrote:

I deployed the jar into myrailsapp/lib dir, and start rails console,

load simple_service.jar and import class SimpleService. The method
“basicLoad” did not run.
Can anyone help me ?

How did you “load simple_service.jar”? simple_service.jar should be on
the $LOAD_PATH somewhere and you should be able to do “require
‘simple_service’”. Adding the jar to the classpath and importing
SimpleService does not accomplish the same thing.

Cheers,
/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I just copy “simple_service.jar” to the “myrailsapp/lib” dir and use
jetty_rails(0.5) as web server. and jetty_rails can load all jars inside
lib/ by default.

I run all the command in rails/console. or where can I find an example
code
for my testing?

thanks, Nick !

JRuby-OpenSSL uses this method for loading a basic library. It’s
pretty much the same as what you have. Pay attention to the package
the java class is in – it needs to be in the default package inside
of the jar.

http://jruby-extras.rubyforge.org/svn/trunk/jopenssl/
http://jruby-extras.rubyforge.org/svn/trunk/jopenssl/src/java/JopensslService.java

/Nick

On Wed, Aug 6, 2008 at 8:31 PM, Yin AnPing [email protected] wrote:

Hi, guys
load simple_service.jar and import class SimpleService. The method

YaPEX
Shanghai, China
http://friendfeed.com/yapex


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs