Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Applet/JavaScript access denied exception, won't initialize

soliver2soliver2 Posts: 2Member
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.