# RJB jave bridge help!

**URL:** <https://www.ruby-forum.com/t/rjb-jave-bridge-help/103081>\
**Category:** Rails\
**Created:** [May 1, 2007, 4:37pm UTC](https://www.ruby-forum.com/t/rjb-jave-bridge-help/103081 "2007-05-01T16:37:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stewbawka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@stewbawka](https://www.ruby-forum.com/u/stewbawka)\
**Post date:** [May 1, 2007, 4:37pm UTC](https://www.ruby-forum.com/t/rjb-jave-bridge-help/103081/1 "2007-05-01T16:37:14Z")

</div>

Why is this happening?  
if i put my Rjb::load method in environment.rb webrick won’t start  
from inside radrails it just sits there trying to connect… however i  
can start webrick manually by doing script/server in a terminal  
window.

i saw some code where instead of having the load method in  
environment.rb they put it in the model that uses it… decided to try  
this, but when i put it in there either inside a ‘connect’ class  
method or just floating inside the body of the class i get the error  
‘can’t create Java VM’…

where does the Rjb::load method go? i left the require in  
environment.rb (but i did try moving it out of desperation trying to  
get things to work)…

any help would be majorly appreciated

---

<div class="post-metadata">

**Author:** ![stewbawka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@stewbawka](https://www.ruby-forum.com/u/stewbawka)\
**Post date:** [May 1, 2007, 5:47pm UTC](https://www.ruby-forum.com/t/rjb-jave-bridge-help/103081/2 "2007-05-01T17:47:22Z")

</div>

I would suggest take this to a JRuby forum. I would guess most people  
here are not running Ruby inside the JVM. I could be wrong. I just  
imagine you’ll get better help from the JRuby guys.

---

<div class="post-metadata">

**Author:** ![stewbawka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@stewbawka](https://www.ruby-forum.com/u/stewbawka)\
**Post date:** [May 1, 2007, 6:43pm UTC](https://www.ruby-forum.com/t/rjb-jave-bridge-help/103081/3 "2007-05-01T18:43:27Z")

</div>

I ran into a similar problem in Windows. It doesn’t detect the  
JAVA\_HOME  
environment variable. I added the following above the Rjb::load line:

ENV[‘JAVA\_HOME’] = ‘C:\Program Files\Java\jdk1.6.0’ if  
ENV[‘JAVA\_HOME’].nil?

- Stephen

---

<div class="post-metadata">

**Author:** ![stewbawka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@stewbawka](https://www.ruby-forum.com/u/stewbawka)\
**Post date:** [May 1, 2007, 7:14pm UTC](https://www.ruby-forum.com/t/rjb-jave-bridge-help/103081/4 "2007-05-01T19:14:30Z")

</div>

Ahhhh! yes the JAVA\_HOME wasn’t getting passed on! thank you so much…  
i’m not on windows, but the ENV[‘JAVA\_HOME’] check failed so i did  
like you suggested (but with linux path). funny thing is that it would  
work fine when i did script/server in the terminal, but trying to  
start the server in radrails kept giving me the ‘can’t start Java  
VM’…

thanks a bunch…

On May 1, 1:42 pm, “Stephen G.”
