开发者

JRuby and CLASSPATH in Windows

I have installed JRuby 1.6.0 on my Windows XP machine. I have also downloaded the Google gdata libraries. This code:

require "java"
$CLASSPATH << "D:\\javalib\\gdata\\java\\lib\\*"
include_class "com.google.gdata.client.docs"

gives this error:

org/jruby/javasupport/JavaClass.j开发者_JAVA技巧ava:1052:in `for_name': cannot load Java class
com.google.gdata.client.docs (NameError)
        from org/jruby/javasupport/JavaUtilities.java:34:in `get_proxy_class'
        from C:/jruby-1.6.0.RC1/lib/ruby/site_ruby/shared/builtin/javasupport/co
re_ext/object.rb:46:in `java_import'
        from C:/jruby-1.6.0.RC1/lib/ruby/site_ruby/shared/builtin/javasupport/co
re_ext/object.rb:26:in `include_class'
        from download_gdocs.rb:5:in `(root)'

The Google gdata Java libraries are in D:\javalib\gdata\java\lib. For example, if I type jar tvf D:\javalib\gdata\java\lib\gdata-client-1.0.jar I get (in part) this:

     0 Fri Feb 04 15:25:54 PST 2011 com/google/gdata/data/docs/
   904 Fri Feb 04 15:25:54 PST 2011 com/google/gdata/client/docs/DocsService$Versions.class
  6686 Fri Feb 04 15:25:54 PST 2011 com/google/gdata/client/docs/DocsService.class


$CLASSPATH doesn't support glob expressions. Instead, require each .jar individually:

Dir["D:\\javalib\\gdata\\java\\lib\\*.jar"].each { |jar| require jar }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜