使用Java中的命令行编译多个包 [英] Compiling multiple packages using the command line in Java

查看:191
本文介绍了使用Java中的命令行编译多个包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我一直在使用IDE,但现在我需要从命令行运行和编译。

Hi i have been using an IDE but now I need to run and compile from the command line.

问题是我有多个包,我试图找到答案,但没有什么工作。

The problem is that I have multiple packages and I have tried to find the answer but nothing has worked.

所以我有

src/
  Support/ (.java files)
  Me/ (.java files) 
  Wrapers/ (.java files)  


b $ b

你知道如何使用javac编译所有内容吗?

Do you know how to compile everything with javac?

推荐答案

元素通过 -cp 命令行开关):

This should do it (may require additional classpath elements via the -cp command line switch):

javac Support/*.java Me/*.java Wrapers/*.java

但是如果你的构建过程变得更复杂(它会!),您应该使用 Apache Ant 进行自动化。

But if your build process gets more complex (and it will!), you should look into using Apache Ant for build automation.

这篇关于使用Java中的命令行编译多个包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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