Eclipse 无法识别包导入?乔格鲁

发布于 2025-01-06 14:09:36 字数 685 浏览 5 评论 0原文

我的路径中有 jogl,这个程序工作正常,直到我包含“import net.java.games.jogl.*;”在代码的顶部。我收到错误“导入无法解析”正如我告诉你的,它无需导入即可工作。已安装本机库并安装 jogl.jar。为什么 Eclipse 无法识别此包导入?这是代码:

import net.java.games.jogl.*;
public class HelloWorld
    { // 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

i have jogl in the path and this program works fine until i include "import net.java.games.jogl.*;" on the top of the code. I get error "Import cannot be resolved" As i told you it works without the import. The Native Libraries are installed and jogl.jar is installed. Why isnt Eclipse recognizing this package import? here is the code:

import net.java.games.jogl.*;
public class HelloWorld
    { // 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一人独醉 2025-01-13 14:09:36

您正在使用的示例似乎使用了过时的包名称。查看 jar 的内容以确定正确的包。

链接(来自 2006 年)建议您可能需要查看包javax.media.opengl。另外,这里是我找到的一些 jogl 的 javadoc 。我不确定它是最新的,但......

It appears that the example you are working from is using an outdated package name. Take a look at the contents of the jar to determine the correct package.

This link (from 2006) is suggesting you may want to look at the package javax.media.opengl. Also, here is some javadoc for jogl that I found. I am not sure how up to date it is though...

深海少女心 2025-01-13 14:09:36

我不确定您是否使用 Maven,但请从 Eclipse 内部检查您的 Java 构建路径。在“库”选项卡下,确保列出了 JOGL。

I am not sure if you are using Maven or not but check your Java Build Path from inside Eclipse. Under Libraries tab ensure that JOGL is listed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文