JyMol web applet example

344 views
Skip to first unread message

Michael

unread,
Sep 1, 2010, 12:28:58 PM9/1/10
to Schrödinger Developer Forum
Dear JyMol developers,

I have been looking at the JyMol web applet examples, and I was
wondering if any of you have them working. In the distribution I
downloaded, the applet directory contains a gpcr directory and two
Make files.
makeMiscApplet.sh would use directories that do not exist (applet/misc
and applet/simple)
Makefile references a myKeys directory that does not exist.

I believe I have translated Makefile into the correct actions on a
windows machine (I am currently using 64-bit winXP), but the jarsigner
fails as I do not have any "Keys." If someone could help me know what
should be in the myKeys directory, I would appreciate it.

Alternatively, if you have a working example of the JyMol web applet,
being able to see it would be very instructional.

Thank you,

Jason Vertrees

unread,
Sep 1, 2010, 4:13:47 PM9/1/10
to schrodinger-d...@googlegroups.com
Hi Michael,

Yes, JyMOL does indeed run from a browser. Applet deployment with
native libraries isn't trivial. Go here
(http://pymol.org/s__test/pymol_interactive_viewer/jymol_applet.html)
to see a working test. This works on Linux, Windows and old Mac
(using JVM prior to 1.6u20). In the original JyMOL jar file we
distribute, please check out the README files--I put some useful links
in there for deployment advice.

myKeys is used for signing the jar file. It's not a directory. You
make the "myKeys" file with keytool
(http://download.oracle.com/javase/1.3/docs/tooldocs/win32/keytool.html)
and you sign with the jarsigner. When deploying applets, there's lots
of work to do to ensure that you're not trying to break the users'
machine(s). So, we have to sign every applet we make available, to
get out of the "sandbox".

But, here's your answer: the HTML code to load JyMOL (pulled from the
above page):

// JavaScript call to enable the applet; reads the JNLP file,
"jymol_applet.jnlp" and loads the JAR file, "JyMOLApplet.jar".
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes = { code:'jymol_applet.JyMOLApplet.class',
width:450, height:450, id: 'jymol_applet', archive: 'JyMOLApplet.jar'
};
var parameters = { jnlp_href: 'jymol_applet.jnlp', id: 'jymol_applet' };
deployJava.runApplet(attributes, parameters, '1.6');
</script>

The JNLP file has the following:

<?xml version="1.0" encoding="UTF-8"?>

<jnlp codebase="http://pymol.org/s__test/pymol_interactive_viewer/"
spec="6.0+"
href="jymol_applet.jnlp"
version="1.0" >

<!-- meta information for all platforms -->
<information>
<title>Demo Applet</title>
<vendor>Schrodinger</vendor>
<homepage href="http://www.pymol.org/" />
<description kind="one-line">JyMOL Interactive Demo</description>
<offline-allowed />
</information>

<!-- request disk I/O and network access -->
<security>
<all-permissions />
</security>

<update check="always" policy="prompt-update" />

<!-- platform independent JAR files -->
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
<jar href="jogl/jogl.jar" download="eager" />
<jar href="gluegen/gluegen-rt.jar" download="eager" />
<jar href="JyMOLApplet.jar" main="true" download="eager" />
<property name="sun.java2d.noddraw" value="true" />
</resources>

<!-- Windows native libraries -->
<resources os="Windows" arch="i386 x86">
<nativelib href="win-core.jar" download="eager" />
<nativelib href="jogl/jogl-natives-windows-x86.jar" download="eager" />
<nativelib href="gluegen/gluegen-rt-natives-windows-x86.jar"
download="eager" />
</resources>

<resources os="Windows" arch="amd64 x86_64">
<nativelib href="win-core.jar" download="eager" />
<nativelib href="jogl/jogl-natives-windows-x86_64.jar" download="eager" />
<nativelib href="gluegen/gluegen-rt-natives-windows-x86_64.jar"
download="eager" />
</resources>


<!-- Linux native libraries -->
<resources os="Linux" arch="i386 x86 i686">
<nativelib href="linux-core-x86.jar" download="eager" />
<nativelib href="jogl/jogl-natives-linux-x86.jar" download="eager" />
<nativelib href="gluegen/gluegen-rt-natives-linux-x86.jar"
download="eager" />
</resources>

<resources os="Linux" arch="x86_64 amd64">
<nativelib href="linux-core-x86_64.jar" download="eager" />
<nativelib href="jogl/jogl-natives-linux-x86_64.jar" download="eager" />
<nativelib href="gluegen/gluegen-rt-natives-linux-x86_64.jar"
download="eager" />
</resources>


<!-- Mac OS X native libraries -->
<resources os="Mac OS X">
<nativelib href="mac-core.jar" download="eager" />
<nativelib href="gluegen/gluegen-rt-natives-macosx-universal.jar"
download="eager" />
<nativelib href="jogl/jogl-natives-macosx-universal.jar" download="eager" />
</resources>

<!-- Run JyMOL as an applet, not an application -->
<applet-desc
main-class="jymol_applet.JyMOLApplet"
name="JyMOLApplet"
width="450"
height="450">
</applet-desc>
</jnlp>


So, as you see you have specify which library is loaded for each
architecture you'd like to support. Deployment is the hardest part of
the applet development process, in my experience.

Give this a shot and let me know how it goes.

-- Jason

P.S. It's a good idea to have an actual web server handy as loading
from file:/// in the browser is not the same as loading from a real
server serving real data.

--
Jason Vertrees, PhD
PyMOL Product Manager
Schrodinger, LLC

(e) Jason.V...@gmail.com
(o) +1 (603) 374-7120

> --
> You received this message because you are subscribed to the Google Groups "Schrödinger Developer Forum" group.
> To post to this group, send email to schrodinger-d...@googlegroups.com.
> To unsubscribe from this group, send email to schrodinger-develop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/schrodinger-developer-forum?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages