我安装了JOGL,但为什么Eclipse不会识别我的hello world程序?

时间:2012-02-17 19:31:41

标签: java eclipse jogl

我安装了Jogl并将其包含在eclipse的构建路径中,但它位于引用的库下。这是程序。

public class exceptionhandler
{ // open HelloWorld

    public static void main(String[] args)
    { // open main
        try
        { // open try
            System.loadLibrary("jogl");
            System.out.println("Hello World! (The native libraries are installed.)");
        } // close try
        catch (Exception e) // all try's need a catch
        { } // even if the catch does nothing
    } // close main

} // close HelloWorld

我没有包含导入,因为Eclipse无法识别它。因此,当我运行它时,我得到这个>

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at exceptionhandler.main(exceptionhandler.java:8)

2 个答案:

答案 0 :(得分:0)

您确定使用最新版本的JOGL吗?您是否也下载了包含本机库的JAR?你有没有把它们放在与jogl-all.jar和gluegen-rt.jar相同的目录中?

答案 1 :(得分:-1)

您是否在Eclipse构建路径设置中指定了jogl.dll的路径?

有关说明,请参阅https://stackoverflow.com/a/958074/1216956