Eclipse 无法识别包导入?乔格鲁
我的路径中有 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在使用的示例似乎使用了过时的包名称。查看 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...我不确定您是否使用 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.