Difference between revisions of "Troubleshooting/Applet"

From Jmol
Jump to navigation Jump to search
(format)
(file access errors)
Line 26: Line 26:
 
Check if you have forgotten to include a call to <code>jmolInitialize()</code> in your page's source code.
 
Check if you have forgotten to include a call to <code>jmolInitialize()</code> in your page's source code.
 
[http://jmol.sourceforge.net/jslibrary/#jmolInitialize Instructions for using jmolInitialize() and the Jmol.js library].
 
[http://jmol.sourceforge.net/jslibrary/#jmolInitialize Instructions for using jmolInitialize() and the Jmol.js library].
 +
 +
 +
== The applet is displayed, but models are not ==
 +
 +
First of all, make sure you have set the paths correctly for the model files (paths should be relative to the html page; in special ocasions you may also work with absolute paths).
 +
 +
If models still fail to load, open the Java console ([[Troubleshooting/Java_Problems#Java_console|instructions]]) and look for errors. Most often, the cause is a Java security restriction (keep on reading below).
 +
 +
=== Java security errors ===
 +
 +
Java imposes a security policy on applets, designed to avoid web pages to act on your local disk. This implies some restrictions on what files can be opened by the Jmol applet.
 +
 +
The rule of thumb is:
 +
* When the page is run from a local disk, Jmol applet can only open files (load models and scripts) that are in the same folder or below where the applet {{file|.jar}} files are.
 +
::(''pending'': Insert here a link to a page with examples of allowed and disallowed folder layouts)
 +
* When the page is run from a web server, Jmol applet can only open files that are in the same server.
 +
* To overcome these limitations, you may use the signed applet, since that will request that the user explicitly gives permission.
 +
 +
The Java security errors related to this will have a format similar to:
 +
<pre>FileManager opening file:sample.mol
 +
script ERROR: script ERROR: io error reading file:sample.mol:
 +
java.security.AccessControlException:
 +
access denied (java.io.FilePermission sample.mol read)
 +
</pre>
 +
 +
See also [[Jmol_Applet#Unsigned_vs._Signed_Applet_.26_Data_Access|Unsigned vs. Signed Applet & Data Access]].

Revision as of 13:49, 8 June 2010

Problems running the Jmol Applet in a web page

The applet does not show up

First of all, wait. Java may take time to load the first time, and the applet must be downloaded.

Yellow square with a message

  • Symptoms:

A yellow square is displayed in the place the applet should go, with a message inside.

  • Solution:

Read the message. Either you don't have Java installed, or the browser is configured not to use it. Enable Java for the browser or (re)install Java from Sun's site.

Black square with an error

  • Symptoms:

A black square is displayed in the place the applet should go, with a message inside: Error. Click to get more information. When you click, a dialog opens:

Application error.
The application could not execute.
Click on 'Details' for more information.

When yopu click, the Java console opens:

load: class JmolApplet not found.
java.lang.ClassNotFoundException: JmolApplet
(etc.)
  • Solution:

Check if you have forgotten to include a call to jmolInitialize() in your page's source code. Instructions for using jmolInitialize() and the Jmol.js library.


The applet is displayed, but models are not

First of all, make sure you have set the paths correctly for the model files (paths should be relative to the html page; in special ocasions you may also work with absolute paths).

If models still fail to load, open the Java console (instructions) and look for errors. Most often, the cause is a Java security restriction (keep on reading below).

Java security errors

Java imposes a security policy on applets, designed to avoid web pages to act on your local disk. This implies some restrictions on what files can be opened by the Jmol applet.

The rule of thumb is:

  • When the page is run from a local disk, Jmol applet can only open files (load models and scripts) that are in the same folder or below where the applet File icon.gif.jar files are.
(pending: Insert here a link to a page with examples of allowed and disallowed folder layouts)
  • When the page is run from a web server, Jmol applet can only open files that are in the same server.
  • To overcome these limitations, you may use the signed applet, since that will request that the user explicitly gives permission.

The Java security errors related to this will have a format similar to:

FileManager opening file:sample.mol
script ERROR: script ERROR: io error reading file:sample.mol: 
java.security.AccessControlException: 
access denied (java.io.FilePermission sample.mol read)

See also Unsigned vs. Signed Applet & Data Access.

Contributors

AngelHerraez, Cudo29