JRuby scripting for Mozilla?

  • Thread starter Kenneth McDonald
  • Start date
K

Kenneth McDonald

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
 
V

Vincent Fourmond

Kenneth said:
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
 
K

Kenneth McDonald

Vincent said:
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
 
V

Vincent Fourmond

Kenneth said:
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
 
C

Charles O Nutter

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

Richard Conroy

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

Peter Szinek

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/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
 
C

Charles O Nutter

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

Peter Szinek

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/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
 
J

John W. Kennedy

Vincent said:
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.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,214
Messages
2,571,112
Members
47,705
Latest member
noname22

Latest Threads

Top