# LoadError: no such file to load -- jruby-win32ole

**URL:** <https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541>\
**Category:** JRuby\
**Created:** [September 12, 2013, 4:51pm UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541 "2013-09-12T16:51:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [September 12, 2013, 4:51pm UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541/1 "2013-09-12T16:51:35Z")

</div>

Dear friends,

I newest in JRuby/Ruby and I’m very enjoy with it, but the last simple  
test is not working when it is executed by java and I need help to find  
what is happen exactly, because when I execute the ruby script file  
directly by RUBY or by JRUBY commands all is fine, but when I try to be  
executed by java shows this error if the require parameter contains  
‘jquery-win32ole’

`
LoadError: no such file to load – jruby-win32ole
require at org/jruby/RubyKernel.java:1054
require at
jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36
(root) at
C:/DEV/test/jruby-test/src/main/ruby/customer_class_selector.rb:1
require at org/jruby/RubyKernel.java:1054
(root) at
jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1
require at
jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36
Exception in thread “main” org.jruby.embed.EvalFailedException:
(LoadError) no such file to load – jruby-win32ole
at
org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:133)
at
org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1264)
at
org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1257)
at JRubyTest.getCustomerClass(JRubyTest.java:18)
at JRubyTest.main(JRubyTest.java:71)
Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file
to load – jruby-win32ole
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054)
at
RUBY.require(jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36)
at
RUBY.(root)(C:/DEV/test/jruby-test/src/main/ruby/customer_class_selector.rb:1)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054)
at
RUBY.(root)(jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1)
at
RUBY.require(jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36)
`

and shows this error if the require parameter is ‘win32ole’

`
!!! Missing jruby-win32ole gem: jruby -S gem install jruby-win32ole
LoadError: no such file to load – jruby-win32ole
require at org/jruby/RubyKernel.java:1054
require at
jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36
(root) at
jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/jruby/win32ole/stub.rb:3
require at org/jruby/RubyKernel.java:1054
(root) at
jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1
require at
jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36
require at org/jruby/RubyKernel.java:1054
(root) at
C:/DEV/test/jruby-test/src/main/ruby/customer_class_selector.rb:2
(root) at
jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1
Exception in thread “main” org.jruby.embed.EvalFailedException:
(LoadError) no such file to load – jruby-win32ole
at
org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:133)
at
org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1264)
at
org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1257)
at JRubyTest.getCustomerClass(JRubyTest.java:18)
at JRubyTest.main(JRubyTest.java:71)
Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file
to load – jruby-win32ole
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054)
at
RUBY.require(jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36)
at
RUBY.(root)(jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/jruby/win32ole/stub.rb:3)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054)
at
RUBY.(root)(jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1)
at
RUBY.require(jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054)
at
RUBY.(root)(C:/DEV/test/jruby-test/src/main/ruby/customer_class_selector.rb:2)
at
RUBY.(root)(jar:file:/C:/Users/accampos/.m2/repository/org/jruby/jruby-complete/1.7.4/jruby-complete-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1)
`

The strange for me because I used the jruby-complete-1.7.4 in the java  
enironment and how I said, it’s executed fine by commands [ jruby | ruby  
]

the java code is simple:

`
ScriptingContainer container = new
ScriptingContainer(LocalContextScope.THREADSAFE);
```
    container.setLoadPaths(Arrays.asList("C:/DEV/test/jruby-test/src/main/ruby"));

    container.runScriptlet("require 'customer_class_selector'");

    Object greeter =

```
container.runScriptlet(“CustomerClassSelector.new”);
```
    @SuppressWarnings("unchecked")
  List<Object> customerClass = container.callMethod(greeter,

```
“get_list”, List.class);
`

But, it fails in java when it parse the require library!

Any idea?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![visitor1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@visitor1981](https://www.ruby-forum.com/u/visitor1981)\
**Post date:** [September 12, 2013, 7:10pm UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541/2 "2013-09-12T19:10:34Z")

</div>

jruby-win32ole gem is not included in jruby-complete.jar. You need to  
install it as a gem in a location that jruby-complete.jar can see.

-Tom

---

<div class="post-metadata">

**Author:** ![visitor1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@visitor1981](https://www.ruby-forum.com/u/visitor1981)\
**Post date:** [September 13, 2013, 8:45am UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541/3 "2013-09-13T08:45:57Z")

</div>

Thanks a lot Tom, it was I thought and this morning looking for the  
win32ole.jar in my computer (it’s inside of gems folder into the  
jbuilder installation) and added to my project. But it has several  
problems with racob integration (dll in the first case and jar in the  
second case) …

Exists any method more clean to add win32ole capabilities into a Java  
project thast uses JRuby?

Maybe I’m doing something worng but my first impression is that it’s not  
finnished, because to add win32ole feature I required to add the gem  
directly as a local repository (I’m using maven) and also, the reference  
to the DLL’s in the ruby file jruby-win32ole.rb into the win32ole.jar  
have problems to load the racob requisite… may be I’m in the wrong  
way and exists another method to add this features to my project.

Could anyone illuminate to me ?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![visitor1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@visitor1981](https://www.ruby-forum.com/u/visitor1981)\
**Post date:** [September 13, 2013, 11:00am UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541/4 "2013-09-13T11:00:55Z")

</div>

Finally , if I remove the win32ole.jar (it is not required because the  
\*.java classes are in the source directory to be compiled, and the rest  
of sources from ruby are in the same lib folder) the error is other…

====================================  
C:\DEV\test\jruby-test\>java -cp  
C:/ide/jruby-1.7.4/lib/jruby.jar;./vendor/gems/jruby-win32ole-0.8.5/lib;./vendor/gems/jruby-win32ole-0.8.5/lib/racob.jar;./src/main/ruby/customer\_class\_selector.rb;./vendor/  
org.jruby.Main ./src/main/ruby/customer\_class\_selector.rb

# LoadError: no such file to load – win32/registry require at org/jruby/RubyKernel.java:1054 (root) at C:/DEV/test/jruby-test/vendor/gems/jruby-win32ole-0.8.5/lib/win32ol e/win32ole\_typelib.rb:1 require at org/jruby/RubyKernel.java:1054 (root) at C:/DEV/test/jruby-test/vendor/gems/jruby-win32ole-0.8.5/lib/jruby-w in32ole.rb:1 require at org/jruby/RubyKernel.java:1054 (root) at ./src/main/ruby/customer\_class\_selector.rb:1

…nobody test it before from java integration or what I’m doing wrong?  
Thanks in advance for your time and effors to help me  
Antonio

---

<div class="post-metadata">

**Author:** ![visitor1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@visitor1981](https://www.ruby-forum.com/u/visitor1981)\
**Post date:** [September 13, 2013, 10:13am UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541/5 "2013-09-13T10:13:26Z")

</div>

Let’s say you have a project structure like this:

project\_root  
|  
|----lib  
| |  
| |–a\_script.rb  
|  
|----vendor  
|  
|----jruby\_complete.jar

A project\_root/ folder. Inside the project\_root is a folder lib, and  
inside  
lib is a single script, a\_script.rb. We’ve also created an empty folder  
in  
project\_root called vendor. Finally, directly inside project\_root we  
have  
jruby\_complete.jar.

Then you can try :

$ jruby -S gem install -i vendor jruby-win32ole

The -i tells the gem command we are telling it where to install the gem  
at,  
so it will install it locally, along with everything ruby needs to use  
it.

$ ls vendor  
cache doc gems specifications

As you see, it created 4 directories inside vendor. This is one reason  
why  
simply copying the gem from your local rubys gem dir wont work.

Now, to run this via the jruby\_complete.jar, we do:

$ java -cp .:jruby-complete.jar:./lib/a\_script.rb:./vendor/  
org.jruby.Main ./lib/a\_script.rb

We make sure everything is on javas classpath (Im not sure, on Windows,  
you may need to use a different separator between classpath items. On  
Ubuntu it is _:_), then we call jruby’s Main on our script. Hope this  
helps.

---

<div class="post-metadata">

**Author:** ![visitor1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@visitor1981](https://www.ruby-forum.com/u/visitor1981)\
**Post date:** [September 13, 2013, 2:13pm UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541/6 "2013-09-13T14:13:15Z")

</div>

Ok, I did the same with the win32-api into the vendor folder (DevKit +  
MinGW installed to proceed to install win32-api correctly) …  
But I can’t see any folder strcuture or folder+file according with  
require ‘win32/registry’

??? any idea

---

<div class="post-metadata">

**Author:** ![visitor1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@visitor1981](https://www.ruby-forum.com/u/visitor1981)\
**Post date:** [September 13, 2013, 10:45am UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541/7 "2013-09-13T10:45:25Z")

</div>

Thanks a lot Tom…

I did your steps and I have now a project with the installed  
jruby-win32ole into the vendor folder and I executed directly your  
proposition by command line, but …

====================================  
C:\DEV\test\jruby-test\>java -cp  
C:/ide/jruby-1.7.4/lib/jruby.jar;./src/main/ruby/customer\_class\_selector.rb;./vendor/  
org.jruby.Main ./src/main/ruby/customer\_cl  
ass\_selector.rb

# LoadError: no such file to load – jruby-win32ole require at org/jruby/RubyKernel.java:1054 (root) at ./src/main/ruby/customer\_class\_selector.rb:1

# Then I added the jars into the classpath, but …

C:\DEV\test\jruby-test\>java -cp  
C:/ide/jruby-1.7.4/lib/jruby.jar;./vendor/gems/jruby-win32ole-0.8.5/lib/win32ole/win32ole.jar;./vendor/gems/jruby-win32ole-0.8.5  
/lib/racob.jar;./src/main/ruby/customer\_class\_selector.rb;./vendor/  
org.jruby.Main ./src/main/ruby/customer\_class\_selector.rb

# LoadError: no such file to load – racob require at org/jruby/RubyKernel.java:1054 (root) at file:/C:/DEV/test/jruby-test/vendor/gems/jruby-win32ole-0.8.5/lib/w in32ole/win32ole.jar!/jruby-win32ole.rb:8 require at org/jruby/RubyKernel.java:1054 (root) at ./src/main/ruby/customer\_class\_selector.rb:1

I added it into the project classpath (in Eclipse) and Also, I added the  
racob.jar and win32ole.jar contained inside, and also I added the \*.java  
classes from the source to be compiled in my project.

# But the error continues:

# LoadError: no such file to load – racob require at org/jruby/RubyKernel.java:1054 (root) at file:/C:/DEV/test/jruby-test/vendor/gems/jruby-win32ole-0.8.5/lib/win32ole/win32ole.jar!/jruby-win32ole.rb:8 require at org/jruby/RubyKernel.java:1054 (root) at C:/DEV/test/jruby-test/src/main/ruby/customer\_class\_selector.rb:1 require at org/jruby/RubyKernel.java:1054 (root) at C:/DEV/test/jruby-test/src/main/ruby/customer\_class\_selector.rb:1 Exception in thread “main” org.jruby.embed.EvalFailedException: (LoadError) no such file to load – racob at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:133) at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1264) at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1257) at JRubyTest.getCustomerClass(JRubyTest.java:18) at JRubyTest.main(JRubyTest.java:71) Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load – racob at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054) at RUBY.(root)(file:/C:/DEV/test/jruby-test/vendor/gems/jruby-win32ole-0.8.5/lib/win32ole/win32ole.jar!/jruby-win32ole.rb:8) at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054) at RUBY.(root)(C:/DEV/test/jruby-test/src/main/ruby/customer\_class\_selector.rb:1) at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054) at RUBY.(root)(C:/DEV/test/jruby-test/src/main/ruby/customer\_class\_selector.rb:1)

Any idea? it’s working in your computer?  
Antonio

---

<div class="post-metadata">

**Author:** ![visitor1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@visitor1981](https://www.ruby-forum.com/u/visitor1981)\
**Post date:** [September 13, 2013, 3:49pm UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541/8 "2013-09-13T15:49:21Z")

</div>

If you set up a GEM\_DIR (or I have even seen people open up  
jruby-complete.jar and gem install and make a new one) environment  
variable  
and jruby -S gem install jruby-win32ole and then make sure your  
environment  
has that GEM\_DIR setting then it should find and load this gem. This is  
how the windows installer works. We don’t do anything more than just  
installing the gem.

I am not sure why the vendor’ing method is not working for you…or do I  
hmm it might have something to do with racob being a JNI extension and  
as  
such it needs java.library.path set to the racob.dll.

Either path (extra GEM directory or fixing vendored solution) will  
require  
setting up some environment setting.

-Tom

---

<div class="post-metadata">

**Author:** ![visitor1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@visitor1981](https://www.ruby-forum.com/u/visitor1981)\
**Post date:** [September 13, 2013, 4:20pm UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541/9 "2013-09-13T16:20:33Z")

</div>

Ok, I think that I uninstall all my jruby and ruby and start again with  
a clean installation (only jruby)… have a nice weekend, more news on  
Monday 😛 thanks for all.

-Antonio

---

<div class="post-metadata">

**Author:** ![visitor1981](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@visitor1981](https://www.ruby-forum.com/u/visitor1981)\
**Post date:** [September 17, 2013, 4:44pm UTC](https://www.ruby-forum.com/t/loaderror-no-such-file-to-load-jruby-win32ole/236541/10 "2013-09-17T16:44:30Z")

</div>

With a clean installation (only jruby without ruby installed) was  
fine…although I couldn’t compile the C extensions in Windows from the  
source (I prefer always to compile the sources), I installed the binary  
package and all was fine in the first execution. You was right,  
something was wrong in the environment execution.

Thanks a lot Tom for your help,  
Have a nice day
