[英]How to compile multiple *.java files
Someone gave me their code: several *.java files under same directory (src\\eval\\*.java). 有人给了我他们的代码:同一目录下的几个* .java文件(src \\ eval \\ *。java)。 I guess they are multiple source code files in the same project.
我猜他们是同一项目中的多个源代码文件。
When trying to compile (under windows), I typed 尝试编译(在Windows下)时,我输入了
javac -sourcepath src\eval\AlnEval.java -d bin
but I get this error when doing so: 但这样做时出现此错误:
javac: no source file.
javac:没有源文件。
Tried 试过了
javac src\eval\AlnEval.java
Many errors in compilation. 编译中的许多错误。 Seems AlnEval.java uses several classes defined in other *.java files.
似乎AlnEval.java使用在其他* .java文件中定义的几个类。
您可以键入javac *.java
或更好地使用和IDE(例如eclipse)
To compile multiple files in one go, you just do 要一次性编译多个文件,您只需执行
javac src\eval\*.java
That's it! 而已!
$ cd src/eval
$ javac *.java
100101010101 100101010101
try below code 尝试下面的代码
first go to your main src directory 首先转到您的主src目录
javac -cp .;lib/<YOU_JARS>.jar -d bin packA/*.java
Try to set the classpath to include the external dependencies. 尝试将类路径设置为包括外部依赖项。 If you have all the dependencies as jar files in a lib directory, for example, you can use
例如,如果您在lib目录中将所有依赖项都保存为jar文件,则可以使用
java -cp lib\* src\eval\*.java
This includes all the dependencies needed to compile the app. 这包括编译应用程序所需的所有依赖项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.