Java jar-Archive tool - Set path for folder with content

夙愿已清 提交于 2019-12-02 14:41:31

问题


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). 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?

Thanks, DigitalClark.

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...


回答1:


This should work, maybe you have to omit the last slash:

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

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

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



来源:https://stackoverflow.com/questions/12872936/java-jar-archive-tool-set-path-for-folder-with-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!