Hi SO,
I'm trying to find a generic way to replicate this C functionality:
int main(int argc, char** argv){
fprintf(2,"%s: error you did something wrong.\n", argv[0]);
return 1;
}
in java. So far the only way was to hardcode this into the app, which is ugly. I'd like to get something similar to:
someObj.getClass().getSimpleName();
inside my static main, without referring back to my own class.
Is this even possible?
Edit
My searching for a good hour didn't turn this one up.
Duplicated question, see http://stackoverflow.com/questions/41894/0-program-name-in-java-discover-main-class for answer