无法在NetBeans中导入sun.org.mozilla.javascript.internal [英] Can't import sun.org.mozilla.javascript.internal in NetBeans

查看:178
本文介绍了无法在NetBeans中导入sun.org.mozilla.javascript.internal的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Java程序中,我大量使用了Rhino脚本引擎的Suns实现.但是最近,我的JDK似乎在编译时不再自动导入rt.jar文件.

In my java program I make heavy use of Suns implmentation of the Rhino script engine. Very recently however, my JDK does not seem to automatically import the rt.jar file anymore when compiling.

奇怪的是NetBeans报告了0个实时错误,它们仅在执行完整的Clean& amp;时才会显示.建造.在导入NativeArray之前,这还没有发生过,所以我对为什么突然停止工作感到困惑.

Whats strange is that NetBeans reports 0 live errors, they only show up when doing a complete Clean & Build. This wasn't happening before when I was importing NativeArray, so I'm really confused on why it all of a sudden stopped working.

规格:

  • 操作系统-Windows
  • Java版本-Java版本"1.6.0_20"
  • Javac版本-javac 1.6.0_20
  • NetBeans版本-6.9

检查是否存在:


C:\Documents and Settings\LordQuackstar\Desktop\TestApp\src>javap sun.org.mozill
a.javascript.internal.WrappedException
Compiled from "WrappedException.java"
public class sun.org.mozilla.javascript.internal.WrappedException extends sun.or
g.mozilla.javascript.internal.EvaluatorException{
    static final long serialVersionUID;
    public sun.org.mozilla.javascript.internal.WrappedException(java.lang.Throwa
ble);
    public java.lang.Throwable getWrappedException();
    public java.lang.Object unwrap();
}

好了,所以这是一些测试代码:

Ok it exists, so here's some test code:

package testapp;

import sun.org.mozilla.javascript.internal.WrappedException;

public class Main {
    public static void main(String[] args) {
        WrappedException e = new WrappedException(null);
    }
}

Netbeans输出:

Netbeans output:


init:
deps-clean:
Updating property file: C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build\built-clean.properties
Deleting directory C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build
clean:
init:
deps-jar:
Created dir: C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build
Updating property file: C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build\built-jar.properties
Created dir: C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build\classes
Created dir: C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build\empty
Compiling 1 source file to C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build\classes
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\src\testapp\Main.java:8: package sun.org.mozilla.javascript.internal does not exist
import sun.org.mozilla.javascript.internal.WrappedException;
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\src\testapp\Main.java:16: cannot find symbol
symbol  : class WrappedException
location: class testapp.Main
                WrappedException e = new WrappedException(null);
                ^
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\src\testapp\Main.java:16: cannot find symbol
symbol  : class WrappedException
location: class testapp.Main
                WrappedException e = new WrappedException(null);
                                         ^
3 errors
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\nbproject\build-impl.xml:528: The following error occurred while executing this line:
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\nbproject\build-impl.xml:261: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)

命令行输出:


C:\Documents and Settings\LordQuackstar\Desktop\TestApp\src\testapp>javac Main.java
Main.java:3: package sun.org.mozilla.javascript.internal does not exist
import sun.org.mozilla.javascript.internal.WrappedException;
                                          ^
Main.java:7: cannot find symbol
symbol  : class WrappedException
location: class testapp.Main
        WrappedException e = new WrappedException(null);
        ^
Main.java:7: cannot find symbol
symbol  : class WrappedException
location: class testapp.Main
        WrappedException e = new WrappedException(null);
                                 ^
3 errors

那么什么会导致它突然失败呢?昨天工作还不错.除了从同一包中导入2个以上的类之外,我没有进行任何更改.我的依赖项都没有改变.

So what would cause this to fail all of a sudden? It was working just fine yesterday. I didn't change anything besides importing 2 more classes from the same package. None of my dependencies changed.

将在linux中进行测试,以查看问题是否仍然存在.

Will test in linux to see if the problem still exists.

在您说出来之前:不,我不会分开下载犀牛,不,我不会更改IDE,

Before you say it: No I'm not download rhino separatly, No I'm not changing IDEs,

推荐答案

有两个迹象表明您不应使用此类:suninternal-这意味着这是一些不应使用的内部类供第三方使用.因为它可以更改或在将来的版本中删除-即,这不是API的一部分.所以-单独下载Rhino.

There are two indications that you shouldn't use this class: sun and internal - these mean that this is some internal class that shouldn't be used by third parties. Because it can change or be removed in future releases - i.e. this is not part of an API. So - download Rhino separately.

如果您使用脚本API,请仅使用API​​类/接口-即

If you are using the scripting API - use only the API classes/interfaces - i.e. javax.script

这篇关于无法在NetBeans中导入sun.org.mozilla.javascript.internal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆