# Java classpath for yajb

**URL:** <https://www.ruby-forum.com/t/java-classpath-for-yajb/77363>\
**Category:** Ruby\
**Created:** [November 27, 2006, 11:51am UTC](https://www.ruby-forum.com/t/java-classpath-for-yajb/77363 "2006-11-27T11:51:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elmar\_Schraml](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/858c86/32.png) [@Elmar\_Schraml](https://www.ruby-forum.com/u/Elmar_Schraml)\
**Post date:** [November 27, 2006, 11:51am UTC](https://www.ruby-forum.com/t/java-classpath-for-yajb/77363/1 "2006-11-27T11:51:12Z")

</div>

Hi,

I’m trying to use a java class via yajb in Ruby on Rails.  
yajb works fine for calling Java library classes, but I can’t get my  
own java classes to work.

I have:

- a class file anon.example.ImportTest in directory  
/home/elmar/railswork/myapp/lib/java/anon/example
- a controller with JBRIDGE\_OPTIONS = { :classpath =\>  
‘/home/elmar/railswork/myapp/lib/java’ }

yet instantiating a ruby variable like  
testvar = jnew :ImportTest  
fails.

Is there anything obvious I’m doing wrong?

Thanks for any help,  
Elmar

---

<div class="post-metadata">

**Author:** ![Elmar\_Schraml](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/858c86/32.png) [@Elmar\_Schraml](https://www.ruby-forum.com/u/Elmar_Schraml)\
**Post date:** [November 28, 2006, 12:03am UTC](https://www.ruby-forum.com/t/java-classpath-for-yajb/77363/2 "2006-11-28T00:03:09Z")

</div>

On Mon, 2006-11-27 at 19:50 +0900, Elmar Schraml wrote:

> Hi,
> 
> I’m trying to use a java class via yajb in Ruby on Rails.  
> yajb works fine for calling Java library classes, but I can’t get my  
> own java classes to work.

Hm, check out this YAJB presentation here:

[http://novarug.org/articles/2006/07/20/august-novarug-meeting](http://novarug.org/articles/2006/07/20/august-novarug-meeting)

I think Paul said something about CLASSPATH in there…

Yours,

tom

---

<div class="post-metadata">

**Author:** ![Elmar\_Schraml](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/858c86/32.png) [@Elmar\_Schraml](https://www.ruby-forum.com/u/Elmar_Schraml)\
**Post date:** [November 28, 2006, 2:45am UTC](https://www.ruby-forum.com/t/java-classpath-for-yajb/77363/3 "2006-11-28T02:45:11Z")

</div>

Here’s a direct link to the slides:  
[http://paul.stadig.name/assets/2006/11/7/Ruby\_Presentation.pdf](http://paul.stadig.name/assets/2006/11/7/Ruby_Presentation.pdf)

You have to configure YAJB with the JBRIDGE\_OPTIONS constant. There’s  
an example on page 9.

Feel free to e-mail me directly (removed\_email\_address@domain.invalid) if you have other  
questions.

Good Luck,  
Paul

Tom C. wrote:

> On Mon, 2006-11-27 at 19:50 +0900, Elmar Schraml wrote:
> 
> > Hi,
> > 
> > I’m trying to use a java class via yajb in Ruby on Rails.  
> > yajb works fine for calling Java library classes, but I can’t get my  
> > own java classes to work.
> 
> Hm, check out this YAJB presentation here:
> 
> [http://novarug.org/articles/2006/07/20/august-novarug-meeting](http://novarug.org/articles/2006/07/20/august-novarug-meeting)
> 
> I think Paul said something about CLASSPATH in there…
> 
> Yours,
> 
> tom
