About System.exit()

Roger Riggs Roger.Riggs at Oracle.com
Tue May 23 13:54:20 UTC 2017


Hi Max,

You could also run the test using ProcessBuilder/Process and check the 
exit status
from Process.waitFor or exitValue().

$.02, Roger


On 5/23/2017 2:12 AM, Weijun Wang wrote:
> I know jtreg does not like System.exit(), but I do have a class 
> calling System.exit() and I'd like to test on it.
>
> Currently, jtreg throws a simple SecurityException. Is it possible to 
> throw an AccessControlException with 
> RuntimePermission("exitVM."+status) associated, just like what 
> SecurityManager::checkExit does? This way I'll be able to test whether 
> my method is calling System.exit() with an expected status code.
>
> Thanks
> Max



More information about the jtreg-dev mailing list