Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个名为 MyVariable 的编译器变量。在一个脚本中,我设置了这个 -
context.setVariable("MyVariable",new String("szzz"));
但是,当我使用这个变量时,它并没有改变它的值
System.out.format("var %s!!!\n",context.getCompilerVariable("MyVariable")); 输出原始值
System.out.format("var %s!!!\n",context.getCompilerVariable("MyVariable"));
运行我的安装程序的调试版本显示变量已更改
我很困惑,希望得到澄清
谢谢
格雷厄姆·拉登
您混合了两个不同的变量系统。
Context#setVariable设置和安装程序变量,Context#getCompilerVariable获取编译器变量的值。
Context#setVariable
Context#getCompilerVariable
编译器变量在编译时是固定的,它们不能在运行时更改。利用
context.getVariable("MyVariable")
获取安装程序变量的值。