且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Tomcat:如何在 Netbeans 中设置 Java 系统属性?

更新时间:2021-09-27 20:12:23

1.转到 Tomcat 属性平台设置

在 Netbeans 中,单击服务"标签.在服务器"下,您将看到Tomcat 7.0".右键单击Tomcat 7.0"并选择属性".然后选择平台"选项卡.

In Netbeans, click the "Services" tag. Under "Servers", you'll see "Tomcat 7.0". Right click "Tomcat 7.0" and select "Properties". Then select the "Platform" tab.

2.在 VM 选项下,添加 -Dvariable=value

将 D 保留在原位,并用您想要设置的任何变量名称替换该变量,并为您想要设置该变量的任何值赋值.

Leave the D in place, and replace the variable with whatever variable name you'd like to set and value whatever value you'd like to set the variable to.

3.从您的代码中读出属性.

System.out.println("The value is " + System.getProperty("variable"));