# RJB in Rails - setting JAVA\_HOME correctly in environment.rb

**URL:** <https://www.ruby-forum.com/t/rjb-in-rails-setting-java-home-correctly-in-environment-rb/74124>\
**Category:** Rails\
**Created:** [October 30, 2006, 11:22pm UTC](https://www.ruby-forum.com/t/rjb-in-rails-setting-java-home-correctly-in-environment-rb/74124 "2006-10-30T23:22:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [October 30, 2006, 11:22pm UTC](https://www.ruby-forum.com/t/rjb-in-rails-setting-java-home-correctly-in-environment-rb/74124/1 "2006-10-30T23:22:53Z")

</div>

All,

I am attempting to use RJB (Java-Ruby Bridge - see:  
[http://arton.no-ip.info/collabo/backyard/?RubyJavaBridge](http://arton.no-ip.info/collabo/backyard/?RubyJavaBridge)) in my Rails  
app.

The documentation says: “Both LD\_LIBRARY\_PATH and JAVA\_HOME setting  
required in environment.rb file of RoR.”

However, it doesn’t say _how_ to set these variables in environment.rb.

I’ve tried

JAVA\_HOME = ‘path\_to\_java\_home’  
ENV[‘JAVA\_HOME’] = ‘path\_to\_java\_home’

but I can’t get it to start the VM.

Is there someone out there who has gotten RJB working inside of their  
Rails app. that can explain the correct way to set these variables in  
environment.rb?

Thanks,  
Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [October 30, 2006, 11:45pm UTC](https://www.ruby-forum.com/t/rjb-in-rails-setting-java-home-correctly-in-environment-rb/74124/2 "2006-10-30T23:45:50Z")

</div>

My bad. I was setting the heap parameters too high - that’s why the JVM  
wouldn’t start. JAVA\_HOME was already set in my environment anyway - I  
didn’t have to do anything in environment.rb.

Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 18, 2008, 12:02am UTC](https://www.ruby-forum.com/t/rjb-in-rails-setting-java-home-correctly-in-environment-rb/74124/3 "2008-03-18T00:02:31Z")

</div>

Heya Wes –

I’m coming across the same problem. How did you go about setting the  
heap parameters?

Thanks for any help!

-Lucas
