File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes The Jarring Dilemma Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "The Jarring Dilemma" Watch "The Jarring Dilemma" New topic

The Jarring Dilemma

Naresh Kumar Bhandari

Joined: Jul 10, 2004
Posts: 1
A real stupid one.

I have heard there is a difference in the following two ways of using the jar command.

In dir "temp" with other subfolders like "misc1" and "misc2".
Each of these subfolders might have other subfolders and files within them.
Even files like ".somename".

- jar -cfmv new.jar META-INF/MANIFEST.MF .
- jar -cfmv new.jar META-INF/MANIFEST.MF *

Is there difference in the way these two commands create the new.jar.
I have tried it and find no difference. But, I have heard that there is a difference.

Thanks in advance.


Life is ours, We live it our way.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


Welcome to JavaRanch!

The answer may actually be a little system-dependent. On UNIX systems, it's up to the command shell to interpret "*", whereas on Winders, it's up to the individual application (last I knew, anyway.) "." means the current directory, and that definitely could include .dotfiles in the current directory; but "*" means only visible files, so .dotfiles in the current directory would not be included.

In both cases, though, recursive handling of the contained directories would be the same. So on UNIX-like systems, anyway, there is a small difference: .dotfiles in the top level directory (only) may be included by ".", and omitted by "*".

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: The Jarring Dilemma
It's not a secret anymore!