Browse the Ruby on Rails Community.

You are here: Forums Ask a Rails expert Using a java applet...

Replytotopic

Using a java applet

Posted in Forums : Ask a Rails expert

 
Profile

Authority 0
Posting Rating 0
Sign in to rate this post

I have a simple rails application. In a web page I want to use a Java applet. To do so, I put the jar file of this applet on the public folder of my rails application.

The code I am using to execute the applet on my page is the following one:

...
<applet code=”applet.TstApplet” name=”TstApplet” archive=”myapplet.jar” align=”center” width=”200” height=”30” MAYSCRIPT/>

However, when I execute the application I have the following error:

ActionController::RoutingError (no route found to match ”/applet/TstApplet.class
” with {:method=>:get}): D:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/a
ction_controller/routing.rb:1292:in `recognize_path’ D:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/a
ction_controller/routing.rb:1282:in `recognize’ D:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatc
her.rb:40:in `dispatch’

Am I doing something wrong or it is just not possible to execute a java applet into a web page of a rails application?

Thank you

Regards

 
Blackburn_120x180

Authority 62
Posting Rating 75
Sign in to rate this post

Paulo, you will need to setup a route in ./config/routes.rb that looks something like this:

map.connect ’/applet’

 
Profile

Authority 0
Posting Rating 0
Sign in to rate this post

thanks!

 
Profile

Authority 12
Posting Rating 96
Sign in to rate this post

I don’t think anything is needed in routes.rb if the files physically exist in the public folder. I think the problem in this case is that the applet files were installed in the wrong place.

If you are trying to load an applet called applet.TstApplet, you need to have the following file: RAILS_ROOT/public/applet/TstApplet.class

i.e. the java package hierarchy gets turned into a directory hierarchy.

 
Me

Authority 37
Posting Rating 100
Sign in to rate this post

I’d have to agree with Jon on that one – defining routes is only need when you’re communicating with Rails, not when you’re just talking to assets such as images or – in your case – applet data because the public folder is set as Apache’s (or whatever http server you’re using) document root.

Replytotopic

Other Recent Topics

Ask a Rails expert : Sanitizing html

Ask a Rails expert : First post, requesting sage perspective

Ask a Rails expert : How to use mephisto

Ask a Rails expert : How to use mephisto

Ask a Rails expert : will_paginate customization problem

Ask a Rails expert : BackgroundRB still wants 'development' environment...?

Ask a Rails expert : activescaffold, sql exception

Ask a Rails expert : Passing non-english chars in query string

Ask a Rails expert : Rails and 2D barcodes

Ask a Rails expert : apache giving proxy error

Formatting Help
  • *bold*       _italics_      
    bq. (quotes)
  • "DSC":http://www.dsc.net
  • * or # (lists)
or cancel