I am using jruby and I need to launch some java code after I initialized something. Below is the code that I need to launch in application.rb. I have the proper classes and libraries imported.
config.after_initialize do
ihp = IPHistoryProcessor.new("/home/ubuntu/jruby/logs/inputFiles/")
end
However I get the following error
LoadError: no such file to load -- /home/ubuntu/jruby/jruby_try_4/config/environment
require at org/jruby/RubyKernel.java:940
block in require at /home/ubuntu/.rvm/gems/jruby-9.0.0.0/gems/activesupport-4.1.12/lib/active_support/dependencies.rb:247
........
I can call the other built in ruby classes but not this java class that I made. I have no idea where the problem could begin. Most indications from other posts I see suggest it is a Passenger problem but I am using Puma for the server. Any help to fix this would be greatly appreciated. Thank you!
you need to tell JRuby where to look for your Java .class
... otherwise it does not know anything about Rails (there's no convention for auto-loading .class files from a location such as lib) ... try :
$CLASSPATH << 'lib/java' # set this early e.g. in boot.rb
or whereverer IPHistoryProcessor.class
is (including the pkg dir structure)