Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Find getWindow(Applet) in netscape.javascript.JSObject

I am trying to call JavaScript functions from a JApplet. I've searched through tutorials and they say that I need to import and use netscape.javascript.* from my \jre\lib\plugin.jar

I did import netscape.javascript.* and I'm using DrJava, and it kept saying it cannot find the getWindow method.

This is the error it gives me:
(MinesweeperApplet extends JApplet)

Error: cannot find symbol  
    symbol:   method getWindow(MinesweeperApplet)  
    location: class netscape.javascript.JSObject

This is the piece of code inside the MinesweeperApplet class where I am trying to get the JSObject:

public void start(){                
    // add stuff    
    JSObject window = JSObject.getWindow(this);    
    Container cp = getContentPane();
    ...

I appreciate any help. Thanks!

like image 978
darolandi Avatar asked May 16 '26 08:05

darolandi


1 Answers

I have found the "solution."

Previously I was using JDK 7. Then I downloaded and tried JDK 6 (update 45) and it could compile fine. And from that point on, the Java-to-Javascript communication works.

like image 70
darolandi Avatar answered May 18 '26 22:05

darolandi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!