为什么getWindow()无法解析?

时间:2012-11-09 12:56:55

标签: java javascript java-7 jsobject

我无法解析getWindow();出于某种原因的方法...

import java.applet.Applet;

import netscape.javascript.JSObject;

public class Class466 {
public static void method6020(Applet applet, String string, int i)
        throws Throwable {
    try {
        JSObject.getWindow(applet).eval(string);
    } catch (RuntimeException runtimeexception) {
        throw Class346.method4175(runtimeexception, new StringBuilder()
                .append("tf.a(").append(')').toString());
    }
}

public static Object method6021(Applet applet, String string, short i)
        throws Throwable {
    try {
        return JSObject.getWindow(applet).call(string, null);
    } catch (RuntimeException runtimeexception) {
        throw Class346.method4175(runtimeexception, new StringBuilder()
                .append("tf.f(").append(')').toString());
    }
}

public static Object method6022(Applet applet, String string,
        Object[] objects, byte i) throws Throwable {
    try {
        return JSObject.getWindow(applet).call(string, objects);
    } catch (RuntimeException runtimeexception) {
        throw Class346.method4175(runtimeexception, new StringBuilder()
                .append("tf.b(").append(')').toString());
    }
}

Class466() throws Throwable {
    throw new Error();
}
}

3 个答案:

答案 0 :(得分:47)

在jdk1.7.0_11中,我注意到../jre/lib/中有两个独立的jar包含netscape.javascript.JSObject.class,即jfxrt.jar和plugin.jar。对于我的IDE(IntelliJ),当我创建一个项目SDK for Java时,它将jfxrt和插件jar添加到类路径中。由于jfxrt.jar在类路径中的plugin.jar之前按字母顺序显示,因此我的应用程序代码未正确解析JSObject.getWindow(...)。由于我们在应用程序中没有使用JavaFX,因此我只是从项目Java SDK类路径中删除了jfxrt.jar。

答案 1 :(得分:0)

是否声明了“MAYSCRIPT”applet标签参数?

<APPLET code="XYZApp.class" codebase="html/" align="baseline"
 width="200" height="200" MAYSCRIPT>

答案 2 :(得分:-2)

我认为你必须补充:

import java.awt.Window;
import java.awt.event.WindowEvent