OK, they get passed to your main method when you write something like:
Code:
public static void main (String argv[]) {
The argv[] is an array of Strings made out of your commandline arguments. Here's an example:
Code:
// tmp.java
public class tmp {
public static void main (String argv[]) {
for(int i=0; i < argv.length; i++) {
System.out.println("Got this on the commandline:" + argv[i]);
}
}
}
And the output:
Code:
charlie@charlie:~$ javac tmp.java
charlie@charlie:~$ java tmp hello world
Got this on the commandline:hello
Got this on the commandline:world
charlie@charlie:~$
HTH,
Charlie
--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock:
http://charlieharvey.org.uk