Blocking a Java app from accessing the Internet
I want to stop the computer to access the Internet using Java program.
How can I do that?
Expert's answerTo stop a particular Java application from accessing the Internet you could use a firewall like Zone Alarm installed on the computer that is capable of controlling outbound traffic to deny the application access to the network. To use a Java program to stop the computer from accessing the Internet you would essentially be implementing a firewall in Java. That will require writing platform specific Java Native Interface (JNI) code to speak to the OS level and intercept network socket traffic, which is possible, but slower and a bit more complicated than using a native compiled language like C, C++, or C# that can talk more directly to the hardware. I suppose you could write a Java program to call out to the system and disable the network interfaces but that would take the machine completely off the network. Searching the Web for "java firewall" brings back quite a few discussions on the topic, most indicating that Java is not the best choice of language for writing a firewall. |


Post new comment