Testing if a jar was executed from commandline or "doubleclick"?

I'm wondering if there's a way to determine whether a jar has been executed from the command line (java -jar <jar>) or through a windows association, like when you double click it in explorer.

As I understand it, there's no System.out (or it's a dummy or something) when you execute a jar through the windows association (even if you "execute" the jar from the commandline, by just typing in the name of the jar, instead of using java -jar). I wonder if this could be a clue?

If anyone has suggestions, I'd appreciate it. Thanks.

-Brian

[573 byte] By [bmearns@coe.neu.edua] at [2007-11-27 4:08:06]
# 1

Determining, whether application was started with java -jar (command line) or javaw (double click) can't be done using System.out properties. The only information that you get about System.out from program is a reference to this stream, and you will have it even if stream is a "dummy" (you won't have null or anything like that).

My offer would be to create a batch file for users starting application with double click and pass some arguments to program from there.

Of course I may be wrong, maybe there is a more "elegant" solution.

Kind Regards

Marecki

marecki6000a at 2007-7-12 9:13:26 > top of Java-index,Desktop,Deploying...