java 如何检查 netbeans 中的编译器和运行时?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1893138/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 18:24:41  来源:igfitidea点击:

how can I check the compiler and runtime in netbeans?

javanetbeans

提问by Johanna

in one of my questions ,somebody said that I have to make sure that I'm not using compiler 1.6 and 1.5 runtime when i want to execute or debug my program,but I don't know how can i check compiler and runtime in NetBeans ,I am beginner with NetBeans.

在我的一个问题中,有人说当我想执行或调试我的程序时,我必须确保我没有使用编译器 1.6 和 1.5 运行时,但我不知道如何在 NetBeans 中检查编译器和运行时,我是 NetBeans 的初学者。

my question was: **I debug my project and the result was :

我的问题是:**我调试我的项目,结果是:

debug: Have no FileObject for C:\Program Files\Java\jdk1.6.0_02\jre\lib\sunrsasign.jar

调试:C:\Program Files\Java\jdk1.6.0_02\jre\lib\sunrsasign.jar 没有 FileObject

Have no FileObject for C:\Program Files\Java\jdk1.6.0_02\jre\classes**

C:\Program Files\Java\jdk1.6.0_02\jre\classes** 没有 FileObject

what should i do?

我该怎么办?

and he answers : you have to make sure that you are not using compiler 1.6 and 1.5 runtime when you want to execute or debug your program

他回答说:当你想执行或调试你的程序时,你必须确保你没有使用编译器 1.6 和 1.5 运行时

回答by nes1983

Here's what I use to find out everything about my building environment (never felt too warm with Eclipse):

以下是我用来了解我的建筑环境的所有信息(使用 Eclipse 从不觉得太温暖):

import static java.lang.System.out;

public class Zeug {
    static String[] opts = new String[] { "java.version", "java.vendor",
            "java.vendor.url", "java.home", "java.vm.specification.version",
            "java.vm.specification.vendor", "java.vm.specification.name",
            "java.vm.version", "java.vm.vendor", "java.vm.name",
            "java.specification.version", "java.specification.vendor",
            "java.specification.name", "java.class.version", "java.class.path",
            "java.library.path", "java.io.tmpdir", "java.compiler",
            "java.ext.dirs", "os.name", "os.arch", "os.version",
            "file.separator", "path.separator", "line.separator", "user.name",
            "user.home", "user.dir" };

    public static void main(String[] args) {
        for(String o : opts) {
            out.println(o + ": " + System.getProperty(o));
        }
    }
}

回答by Ichorus

Go to Tools-->Java Platform and you should see the JDK you are using listed. I am using java-6-sun-1.6.0.16 which does indeed have the jar file you need.

转到工具--> Java 平台,您应该会看到列出的您正在使用的 JDK。我正在使用 java-6-sun-1.6.0.16 它确实有你需要的 jar 文件。

Download the latest JDK from Sun. Go to Tools-->Java Platform and click Add Platform. Navigate to where you installed the latest JDK, name it something meaningful like JDK 1.6.0.16 or whatever and click Finish. Right click on the top level of your project and click Properties. At the top of the popup window change the Java Platform to the one you just added and click ok. At that point, you should not experience your current problem when you compile.

从 Sun 下载最新的 JDK。转至工具-->Java 平台并单击添加平台。导航到安装最新 JDK 的位置,将其命名为有意义的名称,例如 JDK 1.6.0.16 或其他名称,然后单击“完成”。右键单击项目的顶层,然后单击“属性”。在弹出窗口的顶部,将 Java 平台更改为您刚刚添加的平台,然后单击确定。那时,您在编译时不应该遇到当前的问题。

JDK Download Link

JDK下载链接

回答by Michael Borgwardt

You can set the Java version to be used in the project properties (right click on the project).

您可以在项目属性中设置要使用的 Java 版本(右键单击项目)。

Edit:after seeing your specific error message: this seems to be a deeper problem. For some reason Netbeans is looking for a file sunrsasign.jar, which is not normally part of the JDK. Looking for the filename on Google indicates that it's part of a cryptography extension, but that seems to have been integrated into the JDK by now. So the JAR is not needed anymore.

编辑:在看到您的特定错误消息后:这似乎是一个更深层次的问题。出于某种原因,Netbeans 正在寻找一个文件sunrsasign.jar,该文件通常不是 JDK 的一部分。在 Google 上查找文件名表明它是加密扩展的一部分,但现在似乎已集成到 JDK 中。因此不再需要 JAR。

I don't know whether it's Netbeans (are you using the most recent version?) or your application that is mistakenly looking for a JAR that has been integrated into the JDK library itselt.

我不知道是 Netbeans(您使用的是最新版本吗?)还是您的应用程序错误地寻找已集成到 JDK 库本身的 JAR。