I am trying to use the Google gdata Java classes in a JRuby file. I am using JRuby 1.6.0 on Windows XP. Here is my code:
require "java"
include Java
Dir["D:/javalib/gdata/java/lib/*.jar"].each do |jar|
require jar
end
require 'D:/javalib/javamail-1.4.4/mail.jar'
client =
Java::com.google.gdata.client.docs.DocsService.new("yourCo-yourAppName-v1")
Here is the error I get:
org/jruby/javasupport/JavaUtilities.java:54:in `get_proxy_or_package_under_package': cannot link Java class com.google.gdata.client.docs.DocsService, probable missing dependency: javax/mail/MessagingException (NameError)
from C:/jruby-1.6.0.RC1/lib/ruby/site_ruby/shared/builtin/javasupport/java.rb:51:in `method_missing'
from 开发者_如何学运维download_gdocs.rb:8:in `(root)'
I am fairly certain that I am require
'ing the correct JAR file; for example, this code runs without error:
require "java"
include Java
require 'D:/javalib/javamail-1.4.4/mail.jar'
props = java.util.Properties.new();
session = javax.mail.Session.getDefaultInstance(props, nil);
message = javax.mail.internet.MimeMessage.new(session);
It turns out that I had not added the path to the mail.jar in the build.properties file. I guess I should have followed the instructions...
精彩评论