I wrote this class :
public class ListArg {
public static void main(String args[])
{
for(int i=0;i<args.length;i++)
{
System.out.println(args[i]);
}
}
}
javac ListArg.java // compiled class
I compiled above class and run like : java ListArg *
But ListArg is displaying current directory contents on console and not "*".
EDIT: Looks like I was wrong and this might be Java doing it after all. If you're using a Unix shell, this is probably just the shell performing "globbing". However, it appears to do the same thing on Windows, which surprises me (as the Windows command line doesn't perform globbing by default).
Unfortunately, on Windows the normal quoting appears to give you a quoted argument, i.e. if you print args[0]
having run
java ListArg '*'
it will include the single quote. I'm investigating whether there's a way of disabling this... although that would work on a Unix shell.
EDIT: Hmm... no luck so far in managing to have a string of just a star in Windows :(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With