How to disable all network connections in Java

后端 未结 3 395
萌比男神i
萌比男神i 2021-01-05 08:56

Is there a way to run Java VM (java.exe) on Windows Server 2008 and disable all network connections using a command line argument or a system variable?

3条回答
  •  不知归路
    2021-01-05 09:43

    Well, I haven't tried that but theoretically you could set the system properties for SOCKS proxy to a non-existent one and according to the documentation all TCP sockets will be tried through the SOCKS proxy - and fail.

    Something like this:

    java -DsocksProxyHost=127.0.0.1 SomeClass
    

提交回复
热议问题