r*******w 发帖数: 121 | 1 a value from a main() function of a class?
and
how can i get the return value of a function call in a shell script
such as
return_value="java my_prog";
if(return_value==0) do_something;
is it possible to achieve in java?
thanks~ |
e***g 发帖数: 158 | 2 System.exit(0);
【在 r*******w 的大作中提到】![](/moin_static193/solenoid/img/up.png) : a value from a main() function of a class? : and : how can i get the return value of a function call in a shell script : such as : return_value="java my_prog"; : if(return_value==0) do_something; : is it possible to achieve in java? : thanks~
|
r*******w 发帖数: 121 | 3 thanks~~~
is it possible to let "java my_prog" to return the value i returned in the
main function of class my_prog?
it seems to me (by a few small test programs) that "java my_prog" returns the
status code of the program "java"...not "my_prog"...
any workaround for this?
i need the return code of "my_prog" to run a batch job
thanks~
【在 e***g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : System.exit(0);
|
e***g 发帖数: 158 | 4 call System.exit(n) to terminate the program; n is returned to shell
【在 r*******w 的大作中提到】![](/moin_static193/solenoid/img/up.png) : thanks~~~ : is it possible to let "java my_prog" to return the value i returned in the : main function of class my_prog? : it seems to me (by a few small test programs) that "java my_prog" returns the : status code of the program "java"...not "my_prog"... : any workaround for this? : i need the return code of "my_prog" to run a batch job : thanks~
|
r*******w 发帖数: 121 | 5 maybe i am making a stupid mistake...but
here is what i do
class my_prog {
static public void main(String[] args) {
System.exit(-1);
}
}
another perl file:
$return_value=system("java my_prog");
print $return_value;
the print out is random values...each time different...
maybe i did something wrong in the perl file?
the
【在 e***g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : call System.exit(n) to terminate the program; n is returned to shell
|