include java applet in ruby on rails web pages

Hi, I am new to Ruby on Rails world, and would like to combine the ease of RoR web programming with rich graphics and applications from java applets. Wonder if anyone have tried that before? I am having difficulty to use java applet in my .rhtml view files. I ran a simple test case (files given below) and got error that applet could not be started (notinited) or loading java applet failed. When I ran the web page directly (changing Hello.rhtml to Hello.html), it ran fine. I also noticed that in the log file from rails the applet was loaded twice. Like to find out how to include an applet in a ,rhtml file. Please help. Sincerely, HT Yeh

Have you tried using the tag? is really meant for IE only, otherwise you do have the tag. Also, is the class file in the right location for Rails to find it? Though I don’t know where the best place to put it is, whether in public/ or next to the rhtml.

Jason

Have you tried using the <applet> tag? <object> is really meant for IE only,

No, "object" is made for standards compliance. Please read up on html before trying to explain it to others...

otherwise you do have the <embed> tag. Also, is the class file in the right location for Rails to find it? Though I don't know where the best place to put it is, whether in public/ or next to the rhtml.

In public. Unless it's a template of some sort, it doesn't belong in app/views.

> <object codetype="application/java" classid="java:Hello.class" > width="300" height="300" > > </object>

You might want to look around on the w3.org site for information on the object tag. I believe that for modern html, you need only do something like this:

<object type="application/x-java-applet" src="Hello.class" width="300" height="300"> You don't have java :frowning: </object>

With the text in there being the "alternative" text. I use very similar syntax for embedding a couple of flash elements into a site that I've recently completed and it works great. No "applet" or "embed" tags, and it's much cleaner syntax because of it.

Michael

So Sun is completely wrong about applet deploying?

http://java.sun.com/docs/books/tutorial/deployment/applet/deployindex.html

Man the w3 site is frustrating to navigate. Finally found:

http://www.w3.org/TR/html4/struct/objects.html#edef-OBJECT http://www.w3.org/TR/html4/struct/objects.html#edef-APPLET

So the w3 standard is as says, but that means what? We all know that browsers are not fully W3 standardized, especially IE, so I’ll ask again:

Have you tried other tags besides object?

And maybe try informing instead of berating next time, it’s very unbecoming.

Jason

+1 for Jason

You need to export the classpath and javahome before running ruby script/server so that it can find the class...(I think)

here's my example crap (just threw it together out of interest.. but in case you need it) -----------------------------views/test/index.rhtml------------------------------------------------------ <applet width=300 height=300 code="Hello.class"> </applet>

-----------------------------command line crap---------------------------------------------------------- ### Note, I just threw your Hello.java in the jdk bin directory and compiled it from there..

C:\rails\javatest>set CLASSPATH="C:\Program Files\Java\jdk1.5.0_07\bin" C:\rails\javatest>set JAVAHOME="C:\Program Files\Java\jdk1.5.0_07\bin" C:\rails\javatest>ruby script/server

good luck..

So Sun is completely wrong about applet deploying?

JDK 21 Documentation - Home

Apparently. <object> is the future.

Man the w3 site is frustrating to navigate. Finally found:

Objects, Images, and Applets in HTML documents Objects, Images, and Applets in HTML documents

So the w3 standard is as says, but that means what? We all know that browsers are not fully W3 standardized, especially IE,

Right. Ironically, in this case, though, you claim that IE is the browser where "object" works. Think about it.

so I'll ask again:

Have you tried other tags besides object?

And maybe try informing instead of berating next time, it's very unbecoming.

Let's deconstruct this briefly. Some guy asks about using the <object> tag, which is correct. You come in and tell him that he's wrong to use it, that it's an IEism:

> > Have you tried using the <applet> tag? <object> is really meant for IE > only,

I'm not berating you. Just please be careful as bad advice tends to end up in Google.

Michael

Bad advice? Who’s giving bad advice? Are you trying to say that I’m mis-leading the OP? As for in IE, what is there to think about? I read from Sun’s website that is for IE. Thus I recommend using or . If you actually cared about preventing “bad advice” you wouldn’t be launching into an egotistical “you’re wrong, I’m right, and you should know this already” campaign.

As the OP has yet to respond to the topic, why don’t we just wait for it, if it comes and continue to help when and if needed.

Jason