Hello,
The arguments are strings. In my code I need them to be a different type, I do the cast but it is not feasible ...
Have you any idea?
Thank you
Hello,
The arguments are strings. In my code I need them to be a different type, I do the cast but it is not feasible ...
Have you any idea?
Thank you
Arguments are character strings. What datatype do you need them to be?
args are the command line arguments
int firstArg;
if (args.length > 0) {
try {
firstArg = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
System.err.println("Argument" + " must be an integer");
System.exit(1);
}
}
No, it is not an integer. It is an object of a class that I use from an API.
the exception is : cannot cast from string to the object
Please have you an idea?
The shell doesn't handle objects but strings. You should give more clues about this API and what class you are referring to. Casting a string to it is certainly a wrong approach. You should also explain how you pass this object to the shell in the first place.
i use the freepastry API ,
inside my java program prog1.java i call a script (./script.sh a );a is a NodeHandle
script.sh
i want that $1 will be an object NodeHandle in prog2.. but the exception is cannot cast from string to NodeHandle
Thank you
If NodeHandle is serializable, store it somewhere on disk and pass its filename to prog2.
Yes the NodeHandle is serializable, i store it in a buffer like that?
Please how can i deserialize it after?
Don't store it in a buffer, store it in a file. I would suggest using ObjectOutputStream to do it. To deserialize, read the object in the second java application by using ObjectInputStream.
Thank you so much 
I stored the nodehandle in a file and it works, I also need serailiser another object type app I've done it myself, this object contains an attribut that is an object that is not serializable and I need this attribute (this attribute is also from freepastry api ..)
Have you any idea please?