How to add Jar dependencies for JRuby + Trinidad

504 Views Asked by At

I am using JRuby with Trinidad.

It seems I am able to get Trinidad to recognize my class, which is "com.x.HttpClient".

But it doesn't recognize the JARs this class depends on (the HttpClient ones)

I get the error: cannot link Java class com.x.HttpClient, probable missing dependency: org/apache/http/params/HttpParams

I have my jars in my lib/java folder, and my .class file in lib/classes. This is my code:

require 'java'
require 'lib/java/commons-codec-1.6.jar'
require 'lib/java/httpcore-4.2.4.jar'
require 'lib/java/httpclient-4.2.5.jar'
require 'lib/java/httpmime-4.2.5.jar'
require 'lib/java/httpclient-cache-4.2.5.jar'
require 'lib/java/fluent-hc-4.2.5.jar'

java_import 'com.x.HttpClient'

class CrawlerController < ActionController::Base

   ...

end
1

There are 1 best solutions below

0
Gregory Ostermayr On

trinidad has a flag for including jar files

--java_lib LIB_DIR            =>  contains .jar files used by the app