JRuby scripting for Mozilla?

Given that JRuby runs on Java, and Java can, I believe be used to script
Mozilla, is anyone working on a way to use JRuby to script Mozilla?

Thanks,
Ken McDonald

Kenneth McDonald wrote:

Given that JRuby runs on Java, and Java can, I believe be used to script
Mozilla, is anyone working on a way to use JRuby to script Mozilla?

I’m afraid you’re making a common confusion: Javascript runs natively
inside mozilla. Not Java. These two languages share the beginning of
their name, but it’s around all.

Cheers !

Vince

Vincent F. wrote:

Yes, but there is a Java plugin capability for Mozilla–I aware of the
difference :-). However,
I don’t have any experience with Java/Mozilla myself, so I don’t know
exactly how much
can be done (and can’t check right now, as mozdev.org is down for
maintenance.)

Thanks,
Ken

On 10/3/06, Vincent F. [email protected] wrote:

around all. I don’t think you can directly interact with the browser
from within a Java applet. So what you’re looking for seems rather
difficult.

Back in the day there were ways to have Java code access stuff in the
browser, but I don’t know what’s available now. If some capability
exists, however…

There are a few folks who have worked on getting JRuby running as an
applet. Usually the big sticking points were getting the security
settings right and the fact that most Ruby code depends on loose .rb
files (the standard library) being available on a filesystem
somewhere. We’re able to mostly fake that by having the files in
classpath (i.e. packed into a JAR downloaded by the applet) but it’s
not perfect. However, it may not take much work to get it to a solid,
usable point. None of us use applets much, so it’s not being looked
at…but feel free to give it a shot and report your results :slight_smile: I’m
sure there are others out there looking for the same thing.

On 10/3/06, Vincent F. [email protected] wrote:

Kenneth McDonald wrote:

Yes, but there is a Java plugin capability for Mozilla–I aware of the
difference :-). However,
I don’t have any experience with Java/Mozilla myself, so I don’t know
exactly how much
can be done (and can’t check right now, as mozdev.org is down for
maintenance.)

The java plugin capability that you describe is just the method that
installs Java on the system, like flash or quicktime or whatever.

As far as I know (but I never wrote Java applets), Mozilla just gives
a place where Java can display and get user interaction, but that’s
around all. I don’t think you can directly interact with the browser
from within a Java applet. So what you’re looking for seems rather
difficult.

Nods. Java has a defined interface with a browser that is actually quite
limited. While you have some browser control, if you really need to
control the browser you should use Javascript.

Kenneth McDonald wrote:

Yes, but there is a Java plugin capability for Mozilla–I aware of the
difference :-). However,
I don’t have any experience with Java/Mozilla myself, so I don’t know
exactly how much
can be done (and can’t check right now, as mozdev.org is down for
maintenance.)

As far as I know (but I never wrote Java applets), Mozilla just gives
a place where Java can display and get user interaction, but that’s
around all. I don’t think you can directly interact with the browser
from within a Java applet. So what you’re looking for seems rather
difficult.

But that is just my opinion :wink:

Vince

There actually appears to be a Java-XPCOM bridge in the trunk:
http://developer.mozilla.org/en/docs/JavaXPCOM

Regards,
Jordan

I just wanted to mention JavaXPCOM :wink:

In my company we are working on a (commercial) web-extraction tool based
on eclipse, which has a XULRunner
(http://developer.mozilla.org/en/docs/XULRunner) window embedded into
it. The communication happens through JavaXPCOM - I also wrote a Java
connector implementing org.w3c interfaces (which will be probably part
of Eclipse3.3), so I do know JavaXPCOM a little bit… As it’s name
says, it is a pure Java to XPCOM bridge… I did not have that much time
(yet) to play around with JRuby on these levels but I would be very
interested if this could be made to work together…
Unfortunately I don’t have time for this just right now, but please LMK
if someone manages to gets it working!

Peter
http://www.rubyrailways.com

On 10/3/06, Peter S. [email protected] wrote:

I just wanted to mention JavaXPCOM :wink:

I knew there’d be something. It’s too good an idea to not have some
implementation already.

I imagine (have not looked) that it takes the form of other Java to
*COM libraries, and given that it should be pretty simple to use it
for scripting Mozilla in lots of neat ways. At this point I don’t
think we’re even talking about applets anymore, so security models and
such shouldn’t even enter into it. And if the loose library files
become an issue, you can often just go without them; the builtin
classes in Ruby provide most of the features you’d need to script some
application.

Again, I won’t have time to look at this in the short term, but it
sounds like a great use for JRuby.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

MonkeeSage wrote:

There actually appears to be a Java-XPCOM bridge in the trunk:
http://developer.mozilla.org/en/docs/JavaXPCOM

Let’s not forget Ruby-XPCOM! :slight_smile:
http://rbxpcom.mozdev.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFFIwqJmV9O7RYnKMcRAkLvAJ0alTN+Rfk8N8OAbSFSbcdDcKNGMQCfdzRT
dda6WfQ5XH4KYSogmuQZZ04=
=ZsFL
-----END PGP SIGNATURE-----

Let’s not forget Ruby-XPCOM! :slight_smile:

There are a few problems with Ruby-XPCOM:

  1. It is in a very-very… hmmm… early state, which would not be a
    problem per se, but given that the development stopped more than 5 years
    ago (at least I did not find any sign of life since then (2001-08-12, to
    be punctual)).

JavaXPCOM is actively developed, very stable, robust and fast
(Disclaimer: I absolutely love Ruby and I don’t like Java that much at
all, so I am not telling this because I am a Java fanboy (quite the
contrary), but because that’s the truth). We have built a commercial
product used by really big companies based on JavaXPCOM and it (so far)
works.

  1. Let’s forget about 1) - let’s even say it is perfectly solved. Now,
    to do something meaningful, you need a serious GUI which you can
    manipulate with rbXPCOM. In Java’s case this is XULRunner - In Ruby’s
    case it is GTKMozembed ( http://raa.ruby-lang.org/project/gtkmozembed/ )
  • anybody knows about anything else? - which is just not there yet (at
    least as I understood after talking to the author)

I’d be the happiest person on the earth if somebody could prove me
wrong, and the same thing would be possible from Ruby that is now
possible from Java. OK, I did my research a few months ago so it is
possible that somebody created a solution by now…

Peter
http://www.rubyrailways.com

Vincent F. wrote:

around all. I don’t think you can directly interact with the browser
from within a Java applet. So what you’re looking for seems rather
difficult.

There /is/ defined Java/JavaScript glue for when a Java applet is
running embedded in an HTML page containing a JavaScript script.

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