Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to gain socket permissions in java

Tags:

java

sockets

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.

like image 295
andrew Avatar asked Mar 21 '26 01:03

andrew


1 Answers

Verify if your machine has a firewall active, or jar permissions to executions in S.O.

like image 93
Eder F. Freitas Avatar answered Mar 23 '26 15:03

Eder F. Freitas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!