如何递归中所有的sub文件夹中的所有 *。

发布于 2025-02-04 11:35:30 字数 447 浏览 2 评论 0原文

“主要”方法在application \ program.class

“

我可以通过以下方式生成jar file:

jar cvfe PwdGen.jar Application.Program Application\*.class Info\*.class

但是,如果我有更多的目录,则必须添加更多“ direcotory \*。类”附加命令。

是否有一种简单的方法可以包含全部(包括子文件夹) *。

"main" method is in Application\Program.class

Project Structure

I can generate the jar file by:

jar cvfe PwdGen.jar Application.Program Application\*.class Info\*.class

But if I have more directory with more class, I have to add more "direcotory\*.class" attach to the back of command.

Is there a simple way to include all (include sub folders) *.class recursively once for all?

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

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

发布评论

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

评论(2

梦罢 2025-02-11 11:35:30

您可以尝试使用以下命令为多个目录创建JAR。

 jar cvfe pwd.jar */*.class

You could try using the below command to create a jar for multiple directories.

 jar cvfe pwd.jar */*.class
尴尬癌患者 2025-02-11 11:35:30

包括子文件夹的一种合理的简单方法是按级别定义一个参数:

jar cvf PwdGen.jar Application/*.class  Application/*/*.class

如果应用程序中有子文件夹,则将包括在内。如果这些子文件夹有子文件夹,则必须写作:

jar cvf PwdGen.jar Application/*.class  Application/*/*.class Application/*/*/*.class

您必须做同样的信息以获取信息。

在这里请注意一个非常有趣的答案:
如何使用包装结构创建JAR文件?

jar cvf PwdGen.jar Application/*.class .

注意点到底。这将复制完整的结构,而不仅仅是.class文件。我尚未找到只能复制.class文件的语法。

A reasonably simple way of including subfolders is to define one parameter by level :

jar cvf PwdGen.jar Application/*.class  Application/*/*.class

If there are subfolders in Application, they will be included. If these subfolders have subfolders, then you will have to write :

jar cvf PwdGen.jar Application/*.class  Application/*/*.class Application/*/*/*.class

And you have to do the same for Info.

Note a very interesting answer here :
How to create jar file with package structure?

jar cvf PwdGen.jar Application/*.class .

Note the dot in the end. This will copy the full structure, not only the .class files. I have not found a syntax which will copy only the .class files.

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