title: Can't run unit test using JRuby, no such file to load -- rubygems
body: <p>When running same test using ruby only I get success. When trying to run same test from java using JRuby it doesn't find the require files such as "watir-webdriver", "rubygems" etc.</p>
  
  <p>The Ruby file:</p>
  
  <pre><code>require "rubygems"
  require "watir-webdriver"
  
  puts "Hello!!! test finished"
  </code></pre>
  
  <p>Error trace:</p>
  
  <pre><code>LoadError: no such file to load -- rubygems
    require at org/jruby/RubyKernel.java:1054
     (root) at /home/Oras/workspace/OptifyTestSuiteRuby/automation-watir/tes.rb:2
  Exception in thread "main" org.jruby.embed.EvalFailedException: (LoadError) no such file to load -- rubygems
      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:1309)
      at OptifyTest.com.Main.&lt;init&gt;(Main.java:18)
      at OptifyTest.com.Main.main(Main.java:22)
  Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- rubygems
      at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054)
      at RUBY.(root)(/home/Oras/workspace/OptifyTestSuiteRuby/automation-watir/tes.rb:2)
  </code></pre>
  
  <p>The Java file:</p>
  
  <pre><code>import java.util.ArrayList;  
  import java.util.List;  
  
  import org.jruby.embed.PathType;
  import org.jruby.embed.ScriptingContainer;
  
  public class Main {
  private final static String jrubyhome = "/home/Oras/workspace/OptifyTestSuiteRuby/automation-  watir";
  private final String filename = jrubyhome + "/tes.rb";
  
  private Main() {
      ScriptingContainer container = new ScriptingContainer();
      List&lt;String&gt; loadPaths = new ArrayList();
      loadPaths.add(jrubyhome);
      container.setLoadPaths(loadPaths);
      container.runScriptlet(PathType.ABSOLUTE, filename);
  }
  
  public static void main(String[] args) {
      new Main();
  }
  }
  </code></pre>