 |
Forums |
Admin Discussion Forums: help Start New Thread
By: Dave Kroondyk
RE: use rjb from passenger (modrails) on ubuntu [ reply ] 2008-08-22 17:06
|
OK, I got it fixed finally. To set the environment variables for the rails app I could do it in the environment.rb file. I know this is explained right on the ruby to java bridge homepage, but it doesn't explain how. For example, I was able to put:
ENV['JAVA_HOME'] = "/usr/lib/jvm/java-6-sun-1.6.0.06"
in the environment.rb file to set that variable. All is well now - thanks for the excellent Ruby to Java bridge!
|
By: Dave Kroondyk
RE: use rjb from passenger (modrails) on ubuntu [ reply ] 2008-08-21 21:08
|
shoot - just noticed a mistake - I meant to say, when I load script/console - I can do the following:
jar = "/usr/lib/jvm/java-6-sun-1.6.0.06/lib/iText-2.1.3.jar"
require 'rjb'
Rjb::load jar
Rjb::import('com.lowagie.text.pdf.PdfReader')
doing same steps in application.rb gets stuck on "load"
|
By: Dave Kroondyk
use rjb from passenger (modrails) on ubuntu [ reply ] 2008-08-21 21:04
|
So, I've got rjb installed and I have set the following environment variables in /etc/bash.bashrc and /etc/environment
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.06
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server
export LD_PRELOAD=$JAVA_HOME/jre/lib/amd64/server/libjvm.so:$JAVA_HOME/jre/lib/amd64/libzip.so
when I load script/console - I can do the following:
jar = "/usr/lib/jvm/java-6-sun-1.6.0.06/lib/iText-2.1.3.jar"
require 'rjb'
Rjb::import('com.lowagie.text.pdf.PdfReader')
and it will successfully create the object.
Now, I've put these lines at the top of my application.rb file:
require 'rjb'
iTextJar = "/usr/lib/jvm/java-6-sun-1.6.0.06/lib/iText-2.1.3.jar"
Rjb::load iTextJar
but when I hit the application from my browser, I get the "can't create Java VM" error. I assume it's because apache/passenger(modrails) isn't aware of the environment variables - so where can I set them?
Thanks,
Dave
|
|
 |