I run java application in command line linux with external jar like this :
java -cp ".:commons-net-3.6.jar" FtpClass
how can I send argument to main class by command line ?
You need to specify arguments after class like this
java -cp ".:commons-net-3.6.jar" FtpClass A B C
Assume example
public class Example {
public static void main (String[] args) {
for (String s: args) {
System.out.println(s);
}
}
}
The following example shows how a user might run Example.
java Example Drink Hot Java
output is
Drink
Hot
Java