Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Run jar utility to unpack a file in a directory w/spaces?

8 views
Skip to first unread message

Vog...@gmail.com

unread,
May 18, 2007, 2:47:03 PM5/18/07
to
According to the jar syntax, I specify the archive from which the
files are to be extracted:

jar xvf <file>

So -- what if the destination is c:\destination, but the source jar
file is in c:\Documents and Settings\mydir?

cd /d c:\destination
jar xvf c:\Documents and Settings\mydir\myjar.jar

yields

java.io.FileNotFoundException: c:\Documents (The system cannot find
the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:103)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at sun.tools.jar.Main.run(Main.java:185)
at sun.tools.jar.Main.main(Main.java:904)

jar xvf "c:\Documents and Settings\mydir\myjar.jar"

yields

The filename, directory name, or volume label syntax is incorrect.

I *can't* use unzip, which has the -d switch. Is there an equivalent
for jar? The docs seem to say no.

Lew

unread,
May 18, 2007, 5:24:37 PM5/18/07
to

This is a Windows question, not a Java question.

To get Windows to recognize a pathname with embedded spaces, enclose the
pathname in double quotes:

jar xvf "c:\Documents and Settings\mydir\myjar.jar"

or even

jar xvf c:\"Documents and Settings"\mydir\myjar.jar

Ditto for any Windows command:

cd "c:\Documents and Settings\mydir"

--
Lew

Vog...@gmail.com

unread,
May 22, 2007, 12:38:37 PM5/22/07
to

Lew,

I tried the syntax you recommend; see my OP.

Vog...@gmail.com

unread,
May 22, 2007, 3:13:34 PM5/22/07
to
On May 18, 5:24 pm, Lew <l...@nospam.lewscanon.com> wrote:

And, of course, after I responded I found the error of my ways. The
underlying issue was that I was launching this command from within a
VBScript using %comspec% /c "<path_to_jar.exe>" xf
"<path_to_jarfile>".
The construct for <path_to_jar.exe> was bogus. Strange that I got two
different error symptoms, though.

0 new messages