1
不确定是否有其他人遇到此错误,但我正在更新现有的Install4j安装项目。我注意到,每当使用install4j的上下文时,直接使用该字符串。 例如:Install4j常量累积构建失败
context.setVariable("somekey", "Some value");
我想这将是真棒,以“somekey”移动到哪里常数可能在整个install4j和Java代码共享的Java类。
我创建像这样一类:
public class InstallerContextConstants {
public static String KEY = "STRING_KEY";
}
所以我去这个添加到屏幕的activiation前脚本像这样:
import com.somepackage.InstallerContextConstants;
Util.showMessage(InstallerContextConstants.APPLICATION_ONLY_INSTALL);
然而,这不会编译...?它给我:
install4j: compilation failed. Reason: com.ejt.a.c.g: Failed to compile script
----------
In application "Installer", property "Help customizer script":
1. WARNING in /private/var/folders/n7/vjsf1vp56s13hzpgypthp2_h0000gp/T/script4119340027951579520.java.dir/com/install4j/script/I4jScript_Internal_1.java (at line *19)
private void eval(final com.install4j.api.context.InstallerContext context, final java.util.List options) throws Exception {
^^^^^^^^^^^^^^
List is a raw type. References to generic type List<E> should be parameterized
----------
In application "Installer", property "Help customizer script":
2. WARNING in /private/var/folders/n7/vjsf1vp56s13hzpgypthp2_h0000gp/T/script4119340027951579520.java.dir/com/install4j/script/I4jScript_Internal_1.java (at line 1)
if (Util.isLinux()) options.add(new String[] { "--skip-precheck", "Bypasses Installer precheck checks. Note this must be the *first* argument."});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E> should be parameterized
----------
In application "Installer", property "Help customizer script":
3. WARNING in /private/var/folders/n7/vjsf1vp56s13hzpgypthp2_h0000gp/T/script4119340027951579520.java.dir/com/install4j/script/I4jScript_Internal_1.java (at line *24)
eval((com.install4j.api.context.InstallerContext)parameters[0], (java.util.List)parameters[1]);
^^^^^^^^^^^^^^
List is a raw type. References to generic type List<E> should be parameterized
----------
----------
In screen "[Additional confirmations]", property "Pre-activation expression":
4. ERROR in /private/var/folders/n7/vjsf1vp56s13hzpgypthp2_h0000gp/T/script4119340027951579520.java.dir/com/install4j/script/I4jScript_Internal_35.java (at line 5)
Util.showMessage(InstallerContextConstants.KEY);
^^^^^^^^^^^^^^^^^^^^^^^^
KEY cannot be resolved or is not a field
----------
4 problems (1 error, 3 warnings)
然而,如果我使用任何install4j字符串常量它的作品。 http://resources.ej-technologies.com/install4j/help/javadoc/constant-values.html
有关如何做到这一点的任何建议?
我有一些自定义的代码,以及我想用'' 'KEY'''变量。如果我将它作为静态定义添加到Resource步骤,我仍然可以从自定义代码访问它吗? – Dan
那些在install4j之外编译的类文件中的自定义代码?然后,您将不得不将这些定义添加到外部类文件中。 –