About System.exit()

Jonathan Gibbons jonathan.gibbons at oracle.com
Wed May 24 16:20:04 UTC 2017


Max,

Run your test in othervm mode and/or set your own security manager.

-- Jon


On 5/22/17 11:12 PM, 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