Forum Stats

  • 3,875,356 Users
  • 2,266,907 Discussions


block websites

863824 Member Posts: 2
edited May 23, 2011 9:16PM in Java Desktop Applications
Hi there,
does anyone know how to make an application block specific websites without editing the "hosts" file while the app is running?
Which APIs should I eventually use? I've never done anything like that.
Would be very grateful, if someone helps me.


  • 796440
    796440 Member Posts: 19,179 Gold Trophy
    This is not something you can do in pure Java.

    And note that "block specific websites" is a very vague requirement, open to many varying interpretations.
  • handat
    handat Member Posts: 4,688 Gold Crown
    Normally, you would use a firewall application to do this and I strongly suggest you do that. However, you could enable the security manager for your java application and make sure you remove from the security policy and only add for the hosts you want to allow connection to. This would only be practical if you only had a few specific hosts you want the application to be able to connect to and deny connections for any other hosts.
This discussion has been closed.