用Java编译多个类(控制台) [英] Compiling Multiple Classes (Console) in Java

查看:99
本文介绍了用Java编译多个类(控制台)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目有4个类,分别是(标题屏幕,字幕,storyScreen和活动),因为它们相互连接,所以我不知道如何进行编译.还有一件事是,当我使用命令(DOS/CMD)javac时,它仍然不起作用,表示编译器找不到其他类,但它们作为一个类存在.如何编译并使其正常工作?顺便说一下,它是在控制台中还是没有GUI,因此无法在Netbeans中进行清理和构建.

I have 4 Classes for my project, they are (titleScreen, credits, storyScreen, and camapaign) respectively, since they are connected to each other, I don't know how to get it compiled. One more thing is that when I used the commands (DOS / CMD) javac, it still did not work, saying the compiler can not find the other classes, but they are present as a class. How can I compile it and get it to work? By the way it is in console or without the GUI, so Clean and Build in Netbeans does not work.

推荐答案

只要做

javac *.java

或者如果您有单独的源文件夹和二进制文件夹:

Or if you have separate source and binary folders:

mkdir bin
javac -d bin src/*.java

或者如果您有多个源文件夹:

Or if you have multiple source folders:

mkdir bin
shopt -s globstar # requires bash 4
javac -d bin src/**/*.java

这篇关于用Java编译多个类(控制台)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆