0

I have created a jar of my socket program. When I run this jar on a Windows system for the first time it asks for public and home network access. If the user grants them then it works fine and accepts requests from public user's. But if the user denies it then it only works if the firewall is turned off. I want that each time the user runs my jar it should ask for file network access permissions so that in case the user denies it for the first time he can give those permissions next time.

2
  • That's OS specific and user configuration on their machine. NO?
    – The Elite Gentleman
    Jun 29, 2011 at 10:43
  • This is a Windows Firewall setup question, not a programming question.
    – THelper
    Jun 29, 2011 at 10:43

2 Answers 2

2

You can't. This behaviour depends only on the user's Windows' firewall configuration, there is nothing you can do about it in your program. Furthermore, Java isn't supposed to access such system specific details.

5
  • hmmm so i should provide a document along with my app that firewall should be turned off?
    – Dennis
    Jun 29, 2011 at 10:56
  • 1
    Yes. Firewalls blocking apps is a common issue that most user know about.
    – Giann
    Jun 29, 2011 at 10:58
  • @thks..4 the info
    – Dennis
    Jun 29, 2011 at 11:30
  • No. Tell them to add the exception. Turning off the firewall is the equivalent of leaving the front door unlocked vs. giving just your app a copy of the key.
    – Chris Nava
    Jun 29, 2011 at 14:09
  • problem with me is that .jar file doesn't automatically request the access only when i run it from cmd then it asks for it May 3, 2015 at 21:44
1

You can have a policy file in your jar, the policy file containing the required permissions for the application. To know more about policy files, check this link

1
  • @Rakesh can you provide an example like for a folder permission?how can i take that?
    – Dennis
    Jun 29, 2011 at 11:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .