aspose file tools*
The moose likes Beginning Java and the fly likes command line arguments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "command line arguments" Watch "command line arguments" New topic
Author

command line arguments

ye zeya
Greenhorn

Joined: Oct 31, 2008
Posts: 3
Dear ALL..
I am a very beginner to Java and now learning it.Here some little point I want to know clearly.

[edit]Add code tags. CR[/edit]


I made the above program but have error.The idea is to accept the command line arguments and display how many arguments are there.
I can make it by the following alternative way.However..I also would like to know why question for my first program.
Thank you..">
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
Hello Ye,

Welcome to JavaRanch!
I made the above program but have error

I can successfully compile and run it at my end. What error is that?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36599
    
  16
Welcome to JavaRanch
Please use the CODE button; I have edited your original post so you can see how much better it looks.
campbell@linux-747u:~/java> java readArgs Campbell Ritchie Ye Zeya
Campbell
Ritchie
Ye
Zeya
The Number of Arguments = 4
I can see no errors; please supply more details of your problem.

ye zeya
Greenhorn

Joined: Oct 31, 2008
Posts: 3
Arr....Sorry for my childish carelessness. I compiled the program with wrong name readArgs2 in stead of renaming the former program readArgs.java .So the main class does not match the file 's name . .Really sorry for my fault.
Thank you for your kind helps.Next time I will try to avoid such funny mistakes.

Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
NeverMind.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36599
    
  16
We all do things like that
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: command line arguments
 
Similar Threads
can we have * as a command line argument
Command line aurgments
Counting uppercase? Part 2!
main(String[]args)
passing arguments from command line