Casting, in general, only tells the compiler to interpret a variable in a certain way, without actually changing the bits themselves. You can't cast a String to an int because a String is an object containing characters that represent some text, whereas an int is a binary representation of a number. The compiler can't just "pretend" that the String is an int and have it magically become one. You need to call a function to do the conversion. Java includes several in the standard API; I generally use the static method parseInt() in the Integer class:
int i = Integer.parseInt(argv);
Note that if argv isn't a text representation of a number, you'll get a NumberFormatException.