# Ruby on rails and .jar files

**URL:** <https://www.ruby-forum.com/t/ruby-on-rails-and-jar-files/139097>\
**Category:** Deployment\
**Created:** [May 30, 2008, 6:54pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-jar-files/139097 "2008-05-30T18:54:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SurviveStyle5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/eb9ed0/32.png) [@SurviveStyle5](https://www.ruby-forum.com/u/SurviveStyle5)\
**Post date:** [May 30, 2008, 6:54pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-jar-files/139097/1 "2008-05-30T18:54:15Z")

</div>

Hi,  
I’m pretty new to Ruby on Rails and web development in general. I have  
a question and was wondering if anyone could help me out.  
Right now I have some .jar files that are embedded in a web page  
ala…

```
    <Applet code="something.class"
    archive="pluginLib-jre1.6.0_05.jar,some.jar,another.jar"
    width="1200" height="480" MAYSCRIPT=true >

```

…yadda yadda yadda…

```
    </Applet>

```

These work fine in a normal html page (locally, no webserver  
required). When i attempt to embed them within a rails page it cannot  
seem to find the path to the .jar files. I exported the Dir::pwd and i  
checked out Rails ENV and started copying the jar files everywhere but  
it still never seemed to find it it… am I missing something?  
Is there something special i have to do to get rails to recognize  
this? what is my loadpath/where should i be putting these .jar files?

Thanks for the help

---

<div class="post-metadata">

**Author:** ![SurviveStyle5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/eb9ed0/32.png) [@SurviveStyle5](https://www.ruby-forum.com/u/SurviveStyle5)\
**Post date:** [May 31, 2008, 4:32pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-jar-files/139097/2 "2008-05-31T16:32:14Z")

</div>

Hi,

You will either need to put them in a folder (or directly in) the  
public folder OR create a controller that can serve the files out  
using a send\_file method might also work but in general files you want  
to provide go under the public folder (eg. images in public/images).

Once a file is in public the relative path would be /file\_name or if  
it is in a sub-folder (eg. images) /images/file\_name.

I think that covers the basics…

Paul Crawford

---

<div class="post-metadata">

**Author:** ![SurviveStyle5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/eb9ed0/32.png) [@SurviveStyle5](https://www.ruby-forum.com/u/SurviveStyle5)\
**Post date:** [June 1, 2008, 1:47pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-jar-files/139097/3 "2008-06-01T13:47:45Z")

</div>

Also, there is the RAILS\_ROOT variable that helps you find your way from  
the  
rails root directory no matter where the project is.

---

<div class="post-metadata">

**Author:** ![SurviveStyle5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/eb9ed0/32.png) [@SurviveStyle5](https://www.ruby-forum.com/u/SurviveStyle5)\
**Post date:** [June 2, 2008, 10:10pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-jar-files/139097/4 "2008-06-02T22:10:50Z")

</div>

Thanks, i’ll give that a try

---

<div class="post-metadata">

**Author:** ![SurviveStyle5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/eb9ed0/32.png) [@SurviveStyle5](https://www.ruby-forum.com/u/SurviveStyle5)\
**Post date:** [July 11, 2008, 5:49pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-jar-files/139097/5 "2008-07-11T17:49:58Z")

</div>

I have similar problems. Instead of a straightforward class file, I  
have the class file in packages, e.g.

\<applet code=“org.abc.something.class”  
archive=“def.jar”  
width=“1200” height=“480”… \>  
…

Although I have the def.jar file in RAILS\_ROOT/public directory, rails  
complains that it can’t load the class file. It says:

ActionController::RoutingError (no route found to match “//  
org/abc/something.class” with {:method=\>:get}):

Please help. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![SurviveStyle5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/eb9ed0/32.png) [@SurviveStyle5](https://www.ruby-forum.com/u/SurviveStyle5)\
**Post date:** [July 14, 2008, 4:41pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-and-jar-files/139097/6 "2008-07-14T16:41:51Z")

</div>

I found one non-rails but simple workaround.

I setup an apache server and put the java applet in an accessible  
folder, e.g. [http://localhost/public](http://localhost/public). Then in the applet tag, I  
inserted the attribute codebase. e.g.

\<applet codebase=“[http://localhost/public](http://localhost/public)”  
code=“org.abc.something.class”  
archive=“def.jar”  
width=“1200” height=“480”… \>  
…

phew…

However, if there is still a simple way to load an applet from within  
rails I would be very interested to find out as well.
