JRuby 1.6 has just been released and, among the many new features, the JRuby installer for Windows now includes the win32ole library.
This is good news for those of us that frequently use Ruby's win32ole module to automate Excel, Word, and a variety of other Windows applications and processes. Now you have the option of running your code on the JVM.
And running on the JVM opens up a world of possibilities. You could, for example, whip up a Swing GUI via Monkeybars, and use Rawr to package it up as an EXE file for ease of distribution.
Interested? Download JRuby 1.6 at jruby.org, take the win32ole module for a drive around the block, and let me know if you hit any potholes.
10 comments:
This is very cool news, and being able to write Monkeybars apps that hook into Windows apps and opens a lot of interesting doors.
There's a small error in your post, though. The correct URL for the Monkeybars home page is http://www.monkeybars.org.
I don't know why there's anything on rubyforge.org; I thought that was supposed to be shut down a while ago.
Thanks, James!
I have updated the links for both Monkeybars and Rawr.
FYI, The page at rawr.rubyforge.org links to monkeybars.rubyforge.org.
David
Any Progress on the book Dave? Haven't heard anything for a while.
I tried JRuby 1.6.1, but it seems that the jruby-win32ole does not come with the Windows installer -- I still need to install the gem manually. Did I take it wrongly?
I also found there are more than one implementation of jruby-win32ole. So when I run 'gem install jruby-win32ole', which implementation does it install?
Below are 2 implementations I have found:
https://github.com/enebo/jruby-win32ole
https://github.com/bpmcd/win32ole
@Anonymous:
It seems that you are correct: The 1.6.1 installer does not include the win32ole library. Not sure why---I didn't see it mentioned in the release notes.
I had to run the command 'gem install jruby-win32ole'. I believe this installs the enebo version.
I recently came across your blog and have been reading along. I thought I would leave my first comment.
I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.
Thank You
Ruby on Rails
Thanks for the post. Do you have any info on the possibility to use monkeybars (to take advantage of the matisse gui builder) but without having to refactor your code to the MVC pattern that monkeybars wants the user to stick to?
Have you tried using jruby's win32ole library to make ADODB connections to Access databases?
When I try, I get
Java::OrgRacobCom::ComFailException: Invoke of: Open
Source: ADODB.Connection
Description: Provider cannot be found. It may not be properly installed.
(Initially I was trying from within Sequel's ADO adapter, but I get the same error making a naked win32ole call.)
On MRI ruby, I don't get any error connecting to the same Access database.
Thanks for any suggestions - and thanks for you blog!
Eric
@Eric:
This works for me, running JRuby 1.6.7 on a Windows 7 machine...
conn = WIN32OLE.new('ADODB.Connection')
conn.Open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MY_DATABASE.mdb')
rs = WIN32OLE.new('ADODB.Recordset')
rs.Open("SELECT * FROM MY_TABLE;", conn)
...
rs.Close()
conn.Close()
Feel free to send me your sample code via email.
David
I get the same error as 'Eric G' any thoughts?
JRuby 1.7.3, Windows 7 works fine under MRI 2.0.0
using "Provider='Microsoft.ACE.OLEDB.12.0';Data Source='db/development.accdb'"
as the connection string
thanks!
Post a Comment