private boolean permissionsGranted() {
final SocketPermission permission = new SocketPermission(
"239.255.255.250", "connect,accept,resolve");
try {
AccessController.checkPermission(permission);
return true;
} catch (final AccessControlException e) {
try {
e.printStackTrace(new PrintStream("out2.txt"));
} catch (IOException ex) {
}
return false;
}
}
When running the above code in the Netbeans debug environment the above code returns true
but when complied to a .jar and run by simply double clicking the icon it will return false
and I'm at a loss as to why.
I've tried self signing the jar but this did not help.
验证您的计算机是否具有防火墙活动,或者对SO中的执行执行jar权限
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.