JOGL 中的 Hello World
我是 Java
和 Jogl
的新手,最近遇到以下错误:
第一行代码错误:
"The import net cannot be resolved"
第二行:
Multiple markers at this line
- Syntax error, insert "}" to complete ClassBody
- Syntax error, insert "}" to complete ClassBody
换句话说,代码的括号和圆括号不平衡。
import net.java.games.jogl.*;
public class HelloWorld {
public static void main (String args[]) {
try {
System.loadLibrary("jogl");
System.out.println(
"Hello World! (The native libraries are installed.)"
);
现在代码已缩进,很明显我缺少几个 }
。我已经吸取了教训,将从现在开始缩进我的代码。
I'm new to both Java
and Jogl
, and recently ran across the following error:
ERROR for first line of code:
"The import net cannot be resolved"
2ND LINE:
Multiple markers at this line
- Syntax error, insert "}" to complete ClassBody
- Syntax error, insert "}" to complete ClassBody
In other words the code's brackets and parenthesis are unbalanced.
import net.java.games.jogl.*;
public class HelloWorld {
public static void main (String args[]) {
try {
System.loadLibrary("jogl");
System.out.println(
"Hello World! (The native libraries are installed.)"
);
With the code now indented, it is apparent that I have a couple missing }
's. I have learned my lesson and will indent my code from now on.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
类没有修改访问权限:
public class HelloWorld
应为class HelloWorld
。您的牙套不匹配 - 您打开了一些牙套,但没有闭合它们。它应该看起来像这样:
至于未解决的导入,请通过。其他人会比我更了解这个具体问题:)
Classes don't have an access modified:
public class HelloWorld
should beclass HelloWorld
.Your braces don't match up - you've opened some, but not closed them. It should look something like this:
As to the import not being resolved, pass. Someone else will drop by who knows more about this specific problem than I do :)