Every time after a Java update I have to reconfigure the Firewall rule which gets pretty annoying after time...

c:\program files\java\jre1.8.0_131\bin\java.exe

Is it possible to replace "jre1.8.0_131" with a variable within the Windows Firewall?

How do SysAdmins explain to their non-techie clients to modify a firewall rule? :/


1 Answer 1


Ah..developer stupidity at it's finest. I never understood the lack of logic that causes many devs to put their files inside a variable named folder when they know they update it a lot. It's just stupid.

That aside, no, you cannot add a variable like %%SomeFolderName%% like there is for %%PROGRAMFILES%%.

If you try to SETX SomeFolderName "c:\program files\java\jre1.8.0_131\bin\java.exe" and then use 'netsh advfirewall firewall add rule' to add it, attempting that will result in the Firewall Error:

"An error occurred while adding the rule."

Error: The parameter is incorrect

Status: The application name could not be resolved
  • Thanks for your answer! Seriously... is there any way to solve this problem? I can't just manually edit the firewall rules on every system every two months and I also can't just not update a vulnerable application like Java...
    – Clacers
    Jun 9, 2017 at 9:45
  • Make a .bat file for the rules, and when java updates all you have to do is change the numbers in the file and re-run it. This would be the most user-friendly solution at this point. And do drop an e-mail to java about this naming issue. Many more things can fail because of it.
    – Overmind
    Jun 9, 2017 at 9:51
  • Alright, thanks for your help. After all this time I doubt I'm going to be the first one to contact Java about this issue. They probably know and don't care.
    – Clacers
    Jun 9, 2017 at 13:04
  • Better to have multiple people tell them.
    – Overmind
    Jun 12, 2017 at 8:44
  • If you don't mind I'd like to delete the question because there is no solution to it.
    – Clacers
    Jul 30, 2017 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.