从命令行运行 Java 3D 程序

发布于 2024-09-09 20:15:26 字数 229 浏览 2 评论 0原文

我最近在计算机中安装了 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 技术交流群。

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

发布评论

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

评论(2

吃→可爱长大的 2024-09-16 20:15:26

如果您已经在 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 not javac.

If you can export your built project as a JAR (would be in dist folder of your project), you can run it with java -jar myProgram.jar

javac is the Java compiler, should be where you have put the JDK, not Java 3D.

初心 2024-09-16 20:15:26

设置 Java3D 的路径不会对您有太大帮助。当您执行程序时,Java3D jar(如果您查看该目录中的内容就可以找到它们)位于您的类路径中,这一点很重要。因此,为了增强 Bakkal 的建议,您需要类似

java -cp "C:\Program files\Java\Java3d\lib\xxx.jar" -jar myProgram.jar

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

java -cp "C:\Program files\Java\Java3d\lib\xxx.jar" -jar myProgram.jar

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!

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