[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

JRuby scripting for Mozilla?

Kenneth McDonald

10/3/2006 7:10:00 AM

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

12 Answers

Vincent Fourmond

10/3/2006 7:27:00 AM

0

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


Kenneth McDonald

10/3/2006 7:49:00 AM

0

Vincent Fourmond wrote:
> 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.
>
>
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

Vincent Fourmond

10/3/2006 8:10:00 AM

0

Kenneth McDonald wrote:
> Vincent Fourmond wrote:
>> 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.
>>
>>
> 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 ;-)

Vince

Charles O Nutter

10/3/2006 8:49:00 AM

0

On 10/3/06, Vincent Fourmond <vincent.fourmond@9online.fr> 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.)
>
> 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.

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 :) I'm
sure there are others out there looking for the same thing.

--
Contribute to RubySpec! @ www.headius.com/rubyspec
Charles Oliver Nutter @ headius.blogspot.com
Ruby User @ ruby.mn

Richard Conroy

10/3/2006 8:50:00 AM

0

On 10/3/06, Vincent Fourmond <vincent.fourmond@9online.fr> 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.

MonkeeSage

10/3/2006 10:08:00 AM

0

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

Regards,
Jordan

Peter Szinek

10/3/2006 12:02:00 PM

0

I just wanted to mention JavaXPCOM ;-)

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...) 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.rubyra...

MonkeeSage wrote:
> There actually appears to be a Java-XPCOM bridge in the trunk:
> http://developer.mozilla.org/en/docs...
>
> Regards,
> Jordan
>
>


Charles O Nutter

10/3/2006 3:48:00 PM

0

On 10/3/06, Peter Szinek <peter@rubyrailways.com> wrote:
> I just wanted to mention JavaXPCOM ;-)

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.

--
Contribute to RubySpec! @ www.headius.com/rubyspec
Charles Oliver Nutter @ headius.blogspot.com
Ruby User @ ruby.mn

Suraj Kurapati

10/4/2006 1:12:00 AM

0

-----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...

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

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

Peter Szinek

10/4/2006 7:35:00 AM

0

> Let's not forget Ruby-XPCOM! :-)

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.

2) 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/gt... )
- 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.rubyra...