Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes What's so special with Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What Watch "What New topic
Author

What's so special with " * "????

rob javier
Greenhorn

Joined: Oct 20, 2002
Posts: 9
i passed as an argument the symbol " * ". but when i tried to print it, i got this:
arcldr.exe
arcsetup.exe
AUTOEXEC.BAT

btw, my code is as simple as this:
class Ops{
public static void main(String args[]){
System.out.println(args[0]);
System.out.println(args[1]);
System.out.println(args[2]);
}
}
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
Yes. This happens because the Operating System treats * as a wild character. Java can do nothing about it
If you want to pass * as a command line argument, enclose it in quotes
Example: java MyClass "*"
It will work for Windows.
I think it should work in UNIX also. If it doesn't work, try the escape characters
(Example: java MyClass \*)


Mani
Quaerendo Invenietis
rob javier
Greenhorn

Joined: Oct 20, 2002
Posts: 9
thanks
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Moving this to Java in General (Beginner) forum.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What's so special with " * "????
 
Similar Threads
Overloading doubt
operators
statement not reached error
how to get final number ?
Parsing String "*"