# Path for classes called with require

**URL:** <https://www.ruby-forum.com/t/path-for-classes-called-with-require/182056>\
**Category:** FXRuby\
**Created:** [January 22, 2010, 1:28am UTC](https://www.ruby-forum.com/t/path-for-classes-called-with-require/182056 "2010-01-22T01:28:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jessi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ac8455/32.png) [@jessi](https://www.ruby-forum.com/u/jessi)\
**Post date:** [January 22, 2010, 1:28am UTC](https://www.ruby-forum.com/t/path-for-classes-called-with-require/182056/1 "2010-01-22T01:28:16Z")

</div>

I’m working through the ‘picturebook.rb’ example in “FXRuby Create Lean  
and Mean GUIs with Ruby” and got stuck embarrassingly early in the book.  
I’m good up to the point that a blank window pops up (p 28). When I  
proceed to add the other classes (p 30), errors result. The program  
runs fine as shown, but when the commented lines are uncommented an  
error message is shown (below).

Code that replicates p 30 with four lines commented out:

require ‘fox16’

include Fox

#require ‘photo’  
#require ‘photo\_view’

class PictureBook \< FXMainWindow  
def initialize(app)  
super(app, “Picture Book”, :width =\> 600, :height =\> 400)  
#photo = Photo.new(“bridge damage10.jpg”)  
#photo\_view = PhotoView.new(self, photo)  
end

```
def create
    super
    show(PLACEMENT_SCREEN)
end

```

end

if **FILE** == $0  
FXApp.new do |app|  
PictureBook.new(app)  
app.create  
app.run  
end  
end

Error message:

C:/Ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in  
‘gem\_original\_require’: no such file to load – photo (LoadError)

from C:/Ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31: in  
‘require’

from C:/Ruby/myscripts/picturebook/picturebook.rb:5

It seems like the fix would be to path the files so FXRuby can find  
them, but I don’t know what path that would be?

Thanks,  
Jessica

---

<div class="post-metadata">

**Author:** ![jessi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ac8455/32.png) [@jessi](https://www.ruby-forum.com/u/jessi)\
**Post date:** [January 27, 2010, 6:43pm UTC](https://www.ruby-forum.com/t/path-for-classes-called-with-require/182056/2 "2010-01-27T18:43:46Z")

</div>

After reading 7.6 in “The Ruby P.ming Language” I know what path is  
searched first. I was running the program with an absolute path, so the  
other files were not found. Now I’m getting a different error:

C:/Ruby/lib/ruby/site\_ruby/1.8/fox16/kwargs.rb:1193:in ‘old\_initialize’:  
wrong argument type Photo (expected Data) (TypeError)

The error output continues.
