从命令行运行 Java 3D 程序
我最近在计算机中安装了 java 3D,我创建的所有程序都可以在 NetBeans IDE 中运行。但是,当我在命令行中设置路径时,它说 javac 未被识别。 我将路径设置为 C:\Program Files\Java\Java3D\1.5.1\bin
然后输入 javac FirstProgram.java 我收到以下消息(请帮助)
“javac”未被识别为内部或外部命令, 可运行的程序或批处理文件。
I recently installed java 3D in my computer and it all the progras which I created worked from the NetBeans IDE. However when i set the path in the command line, it says that javac is not ercognised.
I set the path to,
C:\Program Files\Java\Java3D\1.5.1\bin
and then typed javac FirstProgram.java
I got the following mesage (please help)
'javac' is not recognized as an internal or external command,
operable program or batch file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您已经在 NetBeans 中编译了项目,那么要运行它,您可以使用
java
而不是javac
。如果您可以将构建的项目导出为 JAR(位于项目的
dist
文件夹中),则可以使用java -jar myProgram.jar
javac 运行它
是Java编译器,应该是你放置JDK的地方,而不是Java 3D。If you have compiled your project in NetBeans already, then to run it you use
java
notjavac
.If you can export your built project as a JAR (would be in
dist
folder of your project), you can run it withjava -jar myProgram.jar
javac
is the Java compiler, should be where you have put the JDK, not Java 3D.设置 Java3D 的路径不会对您有太大帮助。当您执行程序时,Java3D jar(如果您查看该目录中的内容就可以找到它们)位于您的类路径中,这一点很重要。因此,为了增强 Bakkal 的建议,您需要类似
The path to your 3D jar is inquotes 因为目录名称中的空格通常会出现问题。这是微软最愚蠢的错误之一!
Setting the path to Java3D won't help you much. It's important that the Java3D jars (you can find them if you look around the stuff in that directory) are on your classpath when you execute your program. So to augment Bakkal's suggestion, you need something like
The path to your 3D jar is in quotes because of the usual trouble with blanks in a directory name. This is one of Microsoft's most stupid mistakes!