执行多个 Java 类

发布于 2024-08-17 03:38:33 字数 223 浏览 7 评论 0原文

目前我有一个包含 6 个类的文件夹。主类称为“交互”。

我使用 javac *.java 编译所有类

我如何运行该程序?当我输入“java Interaction”时,我收到错误,因为其他类没有被加载。好像我需要将其他 4 个类链接到主类中。我该怎么做?

我正在使用 Windows 命令提示符,

谢谢 Philip

我需要将所有程序设置在一个包中吗?

Currently I have a folder with 6 classes. The main class being called "Interaction".

I compile all the classes by using javac *.java

How do I run the program? When I type "java Interaction" I get errors as the other classes are not being loaded. Its as if I need to link the other 4 classes into the main class. How do I do this?

Im using windows command prompt

Thanks
Philip

Do I need to set all the program in a package or something?

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

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

发布评论

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

评论(1

番薯 2024-08-24 03:38:33

通过在命令提示符下键入“echo %CLASSPATH%”来查看 CLASSPATH 变量。
确保它包含当前目录和任何所需的 jar。
与 Eclipse 使用的进行比较。

Look at the CLASSPATH variable by typing "echo %CLASSPATH%" on the command prompt.
Make sure it includes the current directory and any required jars.
Compare it with the one used by Eclipse.

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