[英]Can I use JAVAC to compile a project with multiple files and directories?
I'm working on a very large project that has associated class files in multiple directories, all stemming from the root dir \\src. 我正在开发一个非常大的项目,它在多个目录中关联了类文件,所有这些都来自root目录\\ src。
I'm trying to compile a file in src\\solution\\ (called Console.java) that uses imports from other directories in the src, which are still uncompiled. 我正在尝试在src \\ solution \\(称为Console.java)中编译一个文件,该文件使用src中其他目录的导入,这些目录仍然是未编译的。
So if I want to compile Console.java outside of an IDE, how do I go about doing that? 因此,如果我想在IDE之外编译Console.java,我该如何去做呢? Oh yeah, I also have some external JARs which need to be included in the build.
哦,是的,我还有一些需要包含在构建中的外部JAR。
Thanks! 谢谢! I appreciate it!
我很感激!
javac comes with two options, that might help you her: javac有两个选项,可能会帮助你:
-c path/to/one/jar;path/to/another/jarfor libraries and
-s path/to/src/solution/java;path/to/src/test/javafor sourcefiles.-s path / to / src / solution / java; path / to / src / test / java
I'm a little unclear on your specific requirements, but what your asking is almost certainly possible. 我对你的具体要求有点不清楚,但你的要求几乎肯定是可能的。 You might want to take a look at the javac options, and see what you can find that will help you.
您可能需要查看javac选项,并查看可以帮助您的内容。
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html#options http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html#options
For example, for the external .jars you need, those need to be included in your classpath using the -classpath option. 例如,对于您需要的外部.jars,需要使用-classpath选项将它们包含在类路径中。
You definitely want a build tool. 你肯定想要一个构建工具。 You might want to look at these questions:
您可能想看看这些问题:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.