I wanted to create a little VNC session on my rails application.  The easiest way to do this was the following:

On my page, create an applet.  This very simply looks like this:

<applet code="VncViewer.class" codebase="/java" ARCHIVE="/java/VncViewer.jar" WIDTH="640" HEIGHT="425" PASSWORD=f00>
<PARAM NAME="PORT" VALUE="5901">
<PARAM NAME="HOST" VALUE="10.3.0.99">
<PARAM NAME="Cursor shape updates" VALUE="Disable">
<PARAM NAME="Share desktop" VALUE="Yes">
<PARAM NAME="Show controls" VALUE="No">
<PARAM NAME="Offer relogin" VALUE="No">
<PARAM NAME="Show offline desktop" VALUE="No">
</applet>

Notice that the IP address is the server that I’m connecting to.

Next, I downloaded the tightVNC source code.  I then made a directory in my rails server:

public/java

and copied the VncViewer.jar file there.

Finally, make sure that vncserver is up and that you have a session with it.  (Try running it manually and connecting with a normal vnc client).  Make sure the passwords match what you have in your applet, then you are ready to roll.