Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 0.9.0
-
Fix Version/s: win32ole 0.8
-
Component/s: Extensions, HelpWanted
-
Labels:None
-
Number of attachments :2
Description
We would like to be able to support the win32ole library in Ruby, so that applications that depend on it could run without modification in JRuby. The easiest way to do this would be to wire in one of the available COM/OLE libraries that exists for the JVM.
I would recommend the Jacob library; it's the library Groovy uses in their own OLE support.
-
Hide
- jwin32ole-rgl-20070617.zip
- 17/Jun/07 1:49 PM
- 168 kB
- Rui Lopes
-
- jwin32ole/build.properties 0.0 kB
- jwin32ole/build.xml 1 kB
- jwin32ole/examples/iis_domains.rb 1 kB
- jwin32ole/examples/use_explorer.rb 1.0 kB
- jwin32ole/.../use_explorer_shell_windows.java 0.8 kB
- jwin32ole/.../use_explorer_shell_windows.rb 0.6 kB
- jwin32ole/examples/use_fso.java 2 kB
- jwin32ole/examples/use_fso.rb 0.7 kB
- jwin32ole/examples/use_ie.rb 0.5 kB
- jwin32ole/lib/jacob.dll 96 kB
- jwin32ole/lib/jacob.jar 45 kB
- jwin32ole/lib/jwin32ole.jar 5 kB
- jwin32ole/lib/win32ole.rb 0.1 kB
- jwin32ole/src/java/Jwin32oleService.java 0.8 kB
- jwin32ole/src/java/.../ext/WIN32OLE.java 10 kB
-
- jacob.patch
- 17/Jun/07 1:49 PM
- 3 kB
- Rui Lopes
Activity
This is my kickoff to implement this extension... you can (YMMV) use the following:
WIN32OLE.new
WIN32OLE.connect
WIN32OLE.each
WIN32OLE.* (calls method, or gets property value of the underline COM object)
WIN32OLE.*= (idem for setting a property)
It has at least one caveat, I don't known how to hook into thread termination to call ComThread.Release(), so the examples\use_explorer_shell_windows.rb seems to hang at the end.
Under the hood, it uses the Jacob library, though, you'll need to patch it with the attached file.
I'm not going to implement anything else until I get feedback from you guys! Why? because with only these features it does all I need it to do.
Best regards,
Rui Lopes
I forgot the change to this inside WIN32OLE class:
private IRubyObject jacobToRuby(Variant value) {
if (value == null || value.isNull())
return getRuntime().getNil();
Object object = value.toJavaObject();
if (object instanceof Dispatch)
return new WIN32OLE(getRuntime(), getType(), (Dispatch) object);
return JavaUtil.convertJavaToRuby(getRuntime(), object);
}
Wow Rui, I hadn't even noticed you started looking at this. Can we get a followup and try to make this go for 1.1? Even if it's only a partial support for the WIN32OLE library, it would be great to have it!
Removing target release from issues that fit any of the following criteria:
- No known way to fix them
- Java integration enhancements out of scope for 1.1 release
- Other out of scope issues for 1.1
Roger: No, unfortunately not. Tom Enebo has experimented with "sort of" implementing win32ole on top of Jacob, but I don't know how far he got. Everyone seems to get a little ways in and then lose interest.
We'd really love for someone to tackle this and give us something we could commit. I really don't think it would be all that hard to do.
I've taken Rui Lopes project and updated it to use the JRuby annotations instead of the call backs. Comments and suggestions welcome. Check out the code at http://github.com/bpmcd/win32ole
Can we promote this library a bit? I tested it wee bit on VMWare, but we obviously need more eyes on it. Perhaps we can include it in 1.5 RC1.
If you're working with Brian's repo, be advised that the maven project properties need some tweaking (jruby.jar path, that is).
looks like the jruby-win32ole gem is the new standard here...
http://stackoverflow.com/questions/3340119/win32ole-gem-for-jruby
After a herculean effort by Tom Enebo, we now have the jruby-win32ole gem! It targets Ruby 1.9.2's win32ole API, and may not be complete...but it's largely there, and we can call this bug resolved.
Any missing or broken parts of win32ole should be filed as new issues.
Thanks also to Audentes Technology LLC, who funded Tom's work.
Thanks for the update Roger! Let us know if you run into any issues, and just file bugs for win32ole in JRuby's tracker (there are versions listed for it now).
I hope it gets incorporated soon, as currently I have to work around this message:
C:\dev\ruby\sensible-cinema>java -client -Xmx500m -Xss1024k -Djruby.memory.max=500m -Djruby.stack.max=1024k -cp "./vendor/cache/jruby-complete-1.5.5.jar" org.jruby.Main bin\sensible-cinema
Loading Sensible Cinema...
!!!! Missing jruby-win32ole gem: jruby -S gem install jruby-win32ole
file:/C:/dev/ruby/sensible-cinema/vendor/cache/jruby-complete-1.5.5.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem jruby-win32ole (>= 0) (Gem::LoadError)
from file:/C:/dev/ruby/sensible-cinema/vendor/cache/jruby-complete-1.5.5.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:211:in `activate'
from file:/C:/dev/ruby/sensible-cinema/vendor/cache/jruby-complete-1.5.5.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:1056:in `gem'
from file:/C:/dev/ruby/sensible-cinema/vendor/cache/jruby-complete-1.5.5.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared/jruby/win32ole/stub.rb:3
from file:/C:/dev/ruby/sensible-cinema/vendor/cache/jruby-complete-1.5.5.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared/jruby/win32ole/stub.rb:31:in `require'
from file:/C:/dev/ruby/sensible-cinema/vendor/cache/jruby-complete-1.5.5.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/dev/ruby/sensible-cinema/vendor/cache/rdp-ruby-wmi-0.3.1/lib/ruby-wmi/core_ext/win32ole_ext.rb:1
from C:/dev/ruby/sensible-cinema/vendor/cache/rdp-ruby-wmi-0.3.1/lib/ruby-wmi/core_ext/win32ole_ext.rb:31:in `require'
from file:/C:/dev/ruby/sensible-cinema/vendor/cache/jruby-complete-1.5.5.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/dev/ruby/sensible-cinema/vendor/cache/rdp-ruby-wmi-0.3.1/lib/ruby-wmi/core_ext.rb:1
from C:/dev/ruby/sensible-cinema/vendor/cache/rdp-ruby-wmi-0.3.1/lib/ruby-wmi/core_ext.rb:1:in `each'
from C:/dev/ruby/sensible-cinema/vendor/cache/rdp-ruby-wmi-0.3.1/lib/ruby-wmi/core_ext.rb:1
from C:/dev/ruby/sensible-cinema/vendor/cache/rdp-ruby-wmi-0.3.1/lib/ruby-wmi/core_ext.rb:31:in `require'
from file:/C:/dev/ruby/sensible-cinema/vendor/cache/jruby-complete-1.5.5.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/dev/ruby/sensible-cinema/vendor/cache/rdp-ruby-wmi-0.3.1/lib/ruby-wmi.rb:4
from C:/dev/ruby/sensible-cinema/vendor/cache/rdp-ruby-wmi-0.3.1/lib/ruby-wmi.rb:31:in `require'
from file:/C:/dev/ruby/sensible-cinema/vendor/cache/jruby-complete-1.5.5.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from bin\sensible-cinema:16
(even though I have the jruby-win32ole gem's lib dir in my $
by creating a fake
'win32ole.rb' file that does
require 'jruby-win32ole'
Cheers!
Roger why aren't you just installing the gem? It should work fine in 1.5.5 once installed.
This is me distributing an app using the jruby-complete-1.5.5.jar...I'm not sure why it required what it does though.
I would still love to do this for 1.0...but that's probably not possible and there's too much work involved, so perhaps we can build it as a gem after the fact? It seems like a good candidate to be pulled out of the standard JRuby distribution anyway.