Board index » jbuilder » How do I return a return-code from main?

How do I return a return-code from main?


2004-03-05 11:01:17 PM
jbuilder15
Hi all,
Pls help with the following:
I have a stand-alone java program which will need to return a return-code to
the running script. I thought I could just use:
return -1;
inside the "public static int main(String[] args)". However, I get an
error. Apparently, I can only have "public static void main(String[]
args)".
Is there a way I can return a return-code?
Thanks,
Bill
 
 

Re:How do I return a return-code from main?

"wl" < XXXX@XXXXX.COM >wrote in message
Quote
Hi all,
Pls help with the following:

I have a stand-alone java program which will need to return a return-code
to
the running script. I thought I could just use:

return -1;

inside the "public static int main(String[] args)". However, I get an
error. Apparently, I can only have "public static void main(String[]
args)".

Is there a way I can return a return-code?

Thanks,
Bill


Try System.exit(-1)
 

Re:How do I return a return-code from main?

Collin VanDyck sez:
Quote
"wl" < XXXX@XXXXX.COM >wrote in message
news:1D02c.33672$ XXXX@XXXXX.COM ...
>Hi all,
>Pls help with the following:
>
>I have a stand-alone java program which will need to return a return-code
to
>the running script. I thought I could just use:
>
>return -1;
>
>inside the "public static int main(String[] args)". However, I get an
>error. Apparently, I can only have "public static void main(String[]
>args)".
>
>Is there a way I can return a return-code?
>
>Thanks,
>Bill
>
>

Try System.exit(-1)
In case you're wondering, it's JVM, not main() that returns to OS.
main() returns to JVM (which may or may not terminate then).
Dima
--
I like the US government, makes the Aussie one look less dumb and THAT is a
pretty big effort. -- Craig Small
 

{smallsort}