Applet/JavaScript access denied exception, won't initialize

i'm attempting to make a version of conway's "game of life" using an embedded applet and a javascript GUI. i can get my applet to initialize in the JDK "applet viewer" when i don't have any references to the javascript in the code, but when i put in any of the lines in red starting with:
[italic]JSObject mainWindow = JSObject.getWindow(this);[/italic]
to begin making references to the javascript objects, i get the following error message:
[b] access denied (java.lang.RuntimePermission accessClassInPackage.netscape.javascript ) ...[/b]. It goes on for awhile, I'll write the whole thing if it helps.
Here is the beginning of my java code (the part that is giving me trouble)...
[code][color=0000CC]import java.applet.*;
import java.awt.*;
import netscape.javascript.*;

public class LifeSim extends Applet {
[color=DD0000]JSObject mainWindow = JSObject.getWindow(this);
JSObject cells = (JSObject) mainWindow.eval("document.cells");[/color]

private final int CELLS = [color=DD0000]Integer.parseInt((String cells.eval("value") );[/color]

public boolean[] booleanBoard = new boolean[CELLS*CELLS];
private boolean[][] board = new boolean[CELLS][CELLS];
private int[][] neighbors = new int[CELLS][CELLS];

public void init() {
LifeSim life = new LifeSim();
if i remove the parts in red, and give a value to CELLS, it initializes just fine, but i NEED to be able to communicate with the javascript or it's useless...any ideas??

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!