aspose file tools*
The moose likes Beginning Java and the fly likes Peculiar behaviour of java XXXXX * Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Peculiar behaviour of java XXXXX *" Watch "Peculiar behaviour of java XXXXX *" New topic
Author

Peculiar behaviour of java XXXXX *

Chandra Bairi
Ranch Hand

Joined: Sep 12, 2003
Posts: 152
giving
java xxxx *
at the command prompt

class xxxx
{
public static void main(String a[])
{
for(int i=0;i<a.length;i++)
{
System.out.println("xxxx " + i + ":" + a[i]);
}
}
}
lists out all the files and dirs inthe current directory? why does this happen what exactly happens?


Thanks,
Shekar
Jaap van Hengstum
Greenhorn

Joined: Jul 24, 2003
Posts: 24
This behaviour is because the Unix commandline has automatic wildcard expansion, which expands any given wildcard on the commandline to its matching filenames before turning control to the program.
Chandra Bairi
Ranch Hand

Joined: Sep 12, 2003
Posts: 152
but this also happens on the windows system. what do u say about this?
Jaap van Hengstum
Greenhorn

Joined: Jul 24, 2003
Posts: 24
My wrong... it seems that java is doing its own wildcard expansion (at least on Windows systems), by the way you can disable this by quoting the commandline argument, like:

myprogram "*"
Chandra Bairi
Ranch Hand

Joined: Sep 12, 2003
Posts: 152
Hello Ernest,
Where are u man? I have been waiting for ur answer. After seeing many answers to the questions which i have posed i have been a great fan of you.
I thought you would help me out. kinldy look into the question and i am sure you will give me a correct answer and I am not flattering.
thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Peculiar behaviour of java XXXXX *