简体   繁体   English

Java jar存档工具-设置包含内容的文件夹的路径

[英]Java jar-Archive tool - Set path for folder with content

When I use this command: 当我使用此命令时:

echo C:\\Program Files\\Java\\jdk1.7.0_07\\bin

jar -cf C:\\file\\file.jar C:\\data\\

in the CMD for the jar-Archive tool, it creates the .jar called "file.jar" in C:\\file\\ , but it doesn't add the files from the folder C:\\data , it creates an archive with the folder C: -> data -> files (in this case text.txt). 在jar-Archive工具的CMD中,它将在C:\\file\\创建一个名为“ file.jar”的.jar,但不会从文件夹C:\\data添加文件,而是使用文件夹C: -> data -> files (在本例中为text.txt)。 How can I set the path for the folder with the content in it? 如何设置包含内容的文件夹的路径? I only want the files in the folder C:\\data\\ in my archive. 我只想要档案中C:\\data\\文件夹中的文件。 How can I do this? 我怎样才能做到这一点?

Thanks, DigitalClark . 谢谢, DigitalClark

btw.: Is there any way to do this without JDK? 顺便说一句:没有JDK,有没有办法做到这一点? Is there another tool? 还有其他工具吗? I don't want the users to install JDK to use just a little program... 我不希望用户安装JDK仅使用一个小程序...

This should work, maybe you have to omit the last slash: 这应该可行,也许您必须省略最后一个斜杠:

jar -cf C:\\file\\file.jar C:\\data jar -cf C:\\ file \\ file.jar C:\\ data

Concerning your last question: Java JDK .jar archive tool alternative 关于您的最后一个问题: Java JDK .jar存档工具替代

Yes, you can use any program that can create zip archives. 是的,您可以使用任何可以创建zip存档的程序。 Your probably have to rename them from *.zip to *.jar 您可能必须将它们从* .zip重命名为* .jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM