简体   繁体   English

Java 应用程序和 Windows 防火墙

[英]Java Application and Windows Firewall

The Windows Firewall blocks my application to connect to different databases. Windows 防火墙阻止我的应用程序连接到不同的数据库。 My application has an installer build using Install4j.我的应用程序有一个使用 Install4j 构建的安装程序。 I am wondering if I can set Firewall rules during installation to allow JDBC connectivity, without asking the user to manually add rules or disable the Windows Firewall.我想知道是否可以在安装期间设置防火墙规则以允许 JDBC 连接,而无需要求用户手动添加规则或禁用 Windows 防火墙。

Running the application as an Administrator creates less issues with the Firewall.以管理员身份运行应用程序对防火墙产生的问题较少。 I can also set the executable to run as an Administrator, but this will prompt the user each time for rights.我还可以将可执行文件设置为以管理员身份运行,但这每次都会提示用户获取权限。

在我们的 install4j 安装程序中,我们使用“运行可执行文件或批处理文件”操作通过 netsh 添加防火墙规则:

netsh advfirewall firewall add rule name="xxx" dir=in action=allow program="xxx" enable=yes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM