Connect with Expertise | Find Experts, Get Answers, Share Insights

Java expands wildcards in command line arguments in Windows: documentation

Bharath Dhurjati
 
Posts: n/a
#1: Jul 17 '05
Hello,

I am looking for documentation that specifies the following behavior
exhibited by java.

The following (assuming MyClass.class is accessible and has a main())

java MyClass *

yields the same result on Windows as on Unix, inspite of Windows not
expanding shell wildcards. Basically, the args[] passed to main()
contains names of files in that directory.

The basic behavior is documented in the following link:
http://groups.google.com/groups?hl=e...argate.sgi.net

The last post by Kevin Kelley points this as 'specified' behavior for
java.exe.

The following link also points this as specified behavior.
http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2

Now I am trying to find out exactly WHERE is this specified.
I have run searches on java.sun.com and used their documentation
searcher also, but couldn't find any documentation.

Can some one please help?

Thanks.

Regards,
Bharath.

mhandis
 
Posts: n/a
#2: Jul 17 '05

re: Java expands wildcards in command line arguments in Windows: documentation


Your statement: "inspite of Windows not expanding shell wildcards" is
not true. Windows does expand the wildcard, just like bash or csh (unix)
does.

If you want to see what is actually being passed in, echo it:
echo java MyClass *

Echo works on both Windows and unix as well.

So this has nothing to do with Java at all.

Bharath Dhurjati wrote:[color=blue]
> Hello,
>
> I am looking for documentation that specifies the following behavior
> exhibited by java.
>
> The following (assuming MyClass.class is accessible and has a main())
>
> java MyClass *
>
> yields the same result on Windows as on Unix, inspite of Windows not
> expanding shell wildcards. Basically, the args[] passed to main()
> contains names of files in that directory.
>
> The basic behavior is documented in the following link:
> http://groups.google.com/groups?hl=e...argate.sgi.net
>
> The last post by Kevin Kelley points this as 'specified' behavior for
> java.exe.
>
> The following link also points this as specified behavior.
> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
>
> Now I am trying to find out exactly WHERE is this specified.
> I have run searches on java.sun.com and used their documentation
> searcher also, but couldn't find any documentation.
>
> Can some one please help?
>
> Thanks.
>
> Regards,
> Bharath.[/color]
CD Rasmussen
 
Posts: n/a
#3: Jul 17 '05

re: Java expands wildcards in command line arguments in Windows: documentation


Not under XP Pro.
echo *
prints "*"
Wild card expansion has never been a function of batch but is done by
whatever is run under batch, see the "for" command in batch for this.

Constantine

mhandis wrote:[color=blue]
> Your statement: "inspite of Windows not expanding shell wildcards" is
> not true. Windows does expand the wildcard, just like bash or csh (unix)
> does.
>
> If you want to see what is actually being passed in, echo it:
> echo java MyClass *
>
> Echo works on both Windows and unix as well.
>
> So this has nothing to do with Java at all.
>
> Bharath Dhurjati wrote:
>[color=green]
>> Hello,
>>
>> I am looking for documentation that specifies the following behavior
>> exhibited by java.
>>
>> The following (assuming MyClass.class is accessible and has a main())
>>
>> java MyClass *
>>
>> yields the same result on Windows as on Unix, inspite of Windows not
>> expanding shell wildcards. Basically, the args[] passed to main()
>> contains names of files in that directory.
>>
>> The basic behavior is documented in the following link:
>> http://groups.google.com/groups?hl=e...argate.sgi.net
>>
>>
>> The last post by Kevin Kelley points this as 'specified' behavior for
>> java.exe.
>>
>> The following link also points this as specified behavior.
>> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
>>
>> Now I am trying to find out exactly WHERE is this specified.
>> I have run searches on java.sun.com and used their documentation
>> searcher also, but couldn't find any documentation.
>>
>> Can some one please help?
>>
>> Thanks.
>>
>> Regards,
>> Bharath.[/color][/color]

CD Rasmussen
 
Posts: n/a
#4: Jul 17 '05

re: Java expands wildcards in command line arguments in Windows: documentation


Not under XP Pro.
echo *
prints "*"
Wild card expansion has never been a function of batch but is done by
whatever is run under batch, see the "for" command in batch for this.

Constantine

mhandis wrote:[color=blue]
> Your statement: "inspite of Windows not expanding shell wildcards" is
> not true. Windows does expand the wildcard, just like bash or csh (unix)
> does.
>
> If you want to see what is actually being passed in, echo it:
> echo java MyClass *
>
> Echo works on both Windows and unix as well.
>
> So this has nothing to do with Java at all.
>
> Bharath Dhurjati wrote:
>[color=green]
>> Hello,
>>
>> I am looking for documentation that specifies the following behavior
>> exhibited by java.
>>
>> The following (assuming MyClass.class is accessible and has a main())
>>
>> java MyClass *
>>
>> yields the same result on Windows as on Unix, inspite of Windows not
>> expanding shell wildcards. Basically, the args[] passed to main()
>> contains names of files in that directory.
>>
>> The basic behavior is documented in the following link:
>> http://groups.google.com/groups?hl=e...argate.sgi.net
>>
>>
>> The last post by Kevin Kelley points this as 'specified' behavior for
>> java.exe.
>>
>> The following link also points this as specified behavior.
>> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
>>
>> Now I am trying to find out exactly WHERE is this specified.
>> I have run searches on java.sun.com and used their documentation
>> searcher also, but couldn't find any documentation.
>>
>> Can some one please help?
>>
>> Thanks.
>>
>> Regards,
>> Bharath.[/color][/color]

nos
 
Posts: n/a
#5: Jul 17 '05

re: Java expands wildcards in command line arguments in Windows: documentation


yes, there is no expansion under XP pro (just tried it too)

I don't have access to win 95 now, but years ago with turbo c++
there was no expansion either and Borland provided an
object file that you could link in to do the expansion prior
to invoking the program

"CD Rasmussen" <Constantine.Rasmussen@comcast.net> wrote in message
news:At6dnTkXE4PWcFCiRVn-vg@comcast.com...[color=blue]
> Not under XP Pro.
> echo *
> prints "*"
> Wild card expansion has never been a function of batch but is done by
> whatever is run under batch, see the "for" command in batch for this.
>
> Constantine
>
> mhandis wrote:[color=green]
> > Your statement: "inspite of Windows not expanding shell wildcards" is
> > not true. Windows does expand the wildcard, just like bash or csh (unix)
> > does.
> >
> > If you want to see what is actually being passed in, echo it:
> > echo java MyClass *
> >
> > Echo works on both Windows and unix as well.
> >
> > So this has nothing to do with Java at all.
> >
> > Bharath Dhurjati wrote:
> >[color=darkred]
> >> Hello,
> >>
> >> I am looking for documentation that specifies the following behavior
> >> exhibited by java.
> >>
> >> The following (assuming MyClass.class is accessible and has a main())
> >>
> >> java MyClass *
> >>
> >> yields the same result on Windows as on Unix, inspite of Windows not
> >> expanding shell wildcards. Basically, the args[] passed to main()
> >> contains names of files in that directory.
> >>
> >> The basic behavior is documented in the following link:
> >>[/color][/color][/color]
http://groups.google.com/groups?hl=e...ame=right&th=3
3f09e2bd3e85a8e&seekm=01be589d%24dc827700%24baac72 d1%40stargate.sgi.net[color=blue][color=green][color=darkred]
> >>
> >>
> >> The last post by Kevin Kelley points this as 'specified' behavior for
> >> java.exe.
> >>
> >> The following link also points this as specified behavior.
> >> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
> >>
> >> Now I am trying to find out exactly WHERE is this specified.
> >> I have run searches on java.sun.com and used their documentation
> >> searcher also, but couldn't find any documentation.
> >>
> >> Can some one please help?
> >>
> >> Thanks.
> >>
> >> Regards,
> >> Bharath.[/color][/color]
>[/color]


nos
 
Posts: n/a
#6: Jul 17 '05

re: Java expands wildcards in command line arguments in Windows: documentation


yes, there is no expansion under XP pro (just tried it too)

I don't have access to win 95 now, but years ago with turbo c++
there was no expansion either and Borland provided an
object file that you could link in to do the expansion prior
to invoking the program

"CD Rasmussen" <Constantine.Rasmussen@comcast.net> wrote in message
news:At6dnTkXE4PWcFCiRVn-vg@comcast.com...[color=blue]
> Not under XP Pro.
> echo *
> prints "*"
> Wild card expansion has never been a function of batch but is done by
> whatever is run under batch, see the "for" command in batch for this.
>
> Constantine
>
> mhandis wrote:[color=green]
> > Your statement: "inspite of Windows not expanding shell wildcards" is
> > not true. Windows does expand the wildcard, just like bash or csh (unix)
> > does.
> >
> > If you want to see what is actually being passed in, echo it:
> > echo java MyClass *
> >
> > Echo works on both Windows and unix as well.
> >
> > So this has nothing to do with Java at all.
> >
> > Bharath Dhurjati wrote:
> >[color=darkred]
> >> Hello,
> >>
> >> I am looking for documentation that specifies the following behavior
> >> exhibited by java.
> >>
> >> The following (assuming MyClass.class is accessible and has a main())
> >>
> >> java MyClass *
> >>
> >> yields the same result on Windows as on Unix, inspite of Windows not
> >> expanding shell wildcards. Basically, the args[] passed to main()
> >> contains names of files in that directory.
> >>
> >> The basic behavior is documented in the following link:
> >>[/color][/color][/color]
http://groups.google.com/groups?hl=e...ame=right&th=3
3f09e2bd3e85a8e&seekm=01be589d%24dc827700%24baac72 d1%40stargate.sgi.net[color=blue][color=green][color=darkred]
> >>
> >>
> >> The last post by Kevin Kelley points this as 'specified' behavior for
> >> java.exe.
> >>
> >> The following link also points this as specified behavior.
> >> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
> >>
> >> Now I am trying to find out exactly WHERE is this specified.
> >> I have run searches on java.sun.com and used their documentation
> >> searcher also, but couldn't find any documentation.
> >>
> >> Can some one please help?
> >>
> >> Thanks.
> >>
> >> Regards,
> >> Bharath.[/color][/color]
>[/color]


mhandis
 
Posts: n/a
#7: Jul 17 '05

re: Java expands wildcards in command line arguments in Windows: documentation


You are right, it doesn't work under windows with echo, only under
unix/linux.

The following C program demonstrates that Windows does expand *:

#include<stdio.h>
int main(int argc, char **argv) {
int i;
for(i = 0; i < argc; i++) {
printf("arg %d = %s\n", i+1, argv[i]);
}
return 0;
}


As does the following Java program:

public class Test {
public static void main(String[] args) {
for(int i = 0; i < args.length; i++) {
System.out.println("arg " + (i+1) + " = " + args[i]);
}
}
}


CD Rasmussen wrote:[color=blue]
> Not under XP Pro.
> echo *
> prints "*"
> Wild card expansion has never been a function of batch but is done by
> whatever is run under batch, see the "for" command in batch for this.
>
> Constantine
>
> mhandis wrote:
>[color=green]
>> Your statement: "inspite of Windows not expanding shell wildcards" is
>> not true. Windows does expand the wildcard, just like bash or csh
>> (unix) does.
>>
>> If you want to see what is actually being passed in, echo it:
>> echo java MyClass *
>>
>> Echo works on both Windows and unix as well.
>>
>> So this has nothing to do with Java at all.
>>
>> Bharath Dhurjati wrote:
>>[color=darkred]
>>> Hello,
>>>
>>> I am looking for documentation that specifies the following behavior
>>> exhibited by java.
>>>
>>> The following (assuming MyClass.class is accessible and has a main())
>>>
>>> java MyClass *
>>>
>>> yields the same result on Windows as on Unix, inspite of Windows not
>>> expanding shell wildcards. Basically, the args[] passed to main()
>>> contains names of files in that directory.
>>>
>>> The basic behavior is documented in the following link:
>>> http://groups.google.com/groups?hl=e...argate.sgi.net
>>>
>>>
>>> The last post by Kevin Kelley points this as 'specified' behavior for
>>> java.exe.
>>>
>>> The following link also points this as specified behavior.
>>> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
>>>
>>> Now I am trying to find out exactly WHERE is this specified.
>>> I have run searches on java.sun.com and used their documentation
>>> searcher also, but couldn't find any documentation.
>>>
>>> Can some one please help?
>>>
>>> Thanks.
>>>
>>> Regards,
>>> Bharath.[/color][/color]
>
>[/color]
Closed Thread