File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
rob javier
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 \*)
 
rob javier
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to Java in General (Beginner) forum.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic