Java jar - 存档工具 - 设置包含内容的文件夹的路径 [英] Java jar-Archive tool - Set path for folder with content

查看:188
本文介绍了Java jar - 存档工具 - 设置包含内容的文件夹的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用这个命令:

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

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

在jar-Archive工具的CMD中,它创建了一个名为file.jar \\ file \ ,但它不会添加文件夹 C:\data 中的文件,它创建一个文件夹 C: - >数据 - >文件(在这种情况下为text.txt)。如何设置其中包含内容的文件夹的路径?我只需要文件夹中的文件 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). 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. How can I do this?

感谢, DigitalClark

btw。:没有JDK,有没有办法做到这一点?还有其他工具吗?我不想让用户安装JDK只使用一个小程序...

btw.: Is there any way to do this without JDK? Is there another tool? I don't want the users to install JDK to use just a little program...

推荐答案

必须省略最后一个斜线:

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

关于您的最后一个问题: Java JDK .jar归档工具备选

Concerning your last question: Java JDK .jar archive tool alternative

是的,您可以使用任何可以创建zip存档的程序。您可能必须将它们从* .zip重命名为* .jar

Yes, you can use any program that can create zip archives. Your probably have to rename them from *.zip to *.jar

这篇关于Java jar - 存档工具 - 设置包含内容的文件夹的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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