In addition Java is signed. So the app is running within a signed/trusted VM that has the right permissions. The OS includes guards in place (at least in Mac) so permissions should be granted if you do something outside of what you're supposed to do.