从 IzPack 调用 Java 类
如何从 IzPack 调用 Java 类的方法?静态方法是可以的,我需要能够传递参数。
谢谢你!
背景信息:
我正在尝试编写一个 IzPack 安装程序,它能够检测以前安装的应用程序版本。在发现它并不真正支持此功能(Windows 中除外)后,我认为实现此目的的唯一方法是编写一个 Java 类并从 IzPack 调用它。
Tim Williscroft 之前有建议 此方法读取类的静态字段的值:
<condition type="java" id="jbossEnv">
<java>
<class>au.com.codarra.ela.installer.JBossChecker</class
<field>hasJBossEnv</field>
</java>
<returnvalue type="boolean">true</returnvalue>
</condition>
但是,是否可以从
之外的其他位置调用
标签?我希望能够从
标记调用它。
另外,是否可以从 Java 类调用方法而不是读取字段的值?我希望能够将参数传递给我的类。
How do you invoke a method from a Java class from IzPack? Static methods are OK, and I need to be able to pass it parameters.
Thank you!
Background info:
I am trying to write an IzPack installer which is able to detect a previously installed versions of the application. After finding out that it doesn't really support this feature (except in Windows), I think the only way to do this is through writing a Java class and calling it from IzPack.
Tim Williscroft has previously suggested this method, that reads the value of a static field of a class:
<condition type="java" id="jbossEnv">
<java>
<class>au.com.codarra.ela.installer.JBossChecker</class
<field>hasJBossEnv</field>
</java>
<returnvalue type="boolean">true</returnvalue>
</condition>
However, is it possible to call <java>
from somewhere other than a <condition>
tag? I want to be able to call it from a <variable>
tag.
Also, is it possible to call a method from a Java class instead of reading a value of a field? I want to be able to pass parameters to my class.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以调用静态方法,但我认为您不能传入参数。
您可以创建一个新的“条件类型”,但我没有这方面的经验,所以我无法确认它提供的灵活性...
所以,我没有直接回应,但另一个可能有帮助的建议:
我倾向于将任何复杂的后处理传递给单独的进程。
您调查过处理面板吗? 您可以启动任何进程,并传入变量..
例如,
我用它来设置服务并立即启动。那种事。只需确保您的脚本干净退出,否则 IzPack 将挂起。
参见这里:
http://izpack.org/documentation/panels.html#processpanel
You can call static methods, but I don't think you can pass in parameters.
You could create a new 'Condition type', but I have no experience with this so I can't confirm the flexibility it provides...
So, I don't have a direct response, but another suggestion which might help:
I tend to pass any complex post-processing on to separate processes.
Have you investigated the Processing panel? You can start any process, and pass in variables ..
e.g.
I've used it to set up services and start up immediately. That kind of thing. Just make sure your script exits cleanly, otherwise IzPack will hang.
See here:
http://izpack.org/documentation/panels.html#processpanel
考虑使用 IzPack Ant 集成
http://izpack.org/documentation/advanced -features.html#apache-ant-integration
和 Ant Java 标注任务
http ://ant.apache.org/manual/Tasks/java.html
Consider using the IzPack Ant integration
http://izpack.org/documentation/advanced-features.html#apache-ant-integration
and the Ant Java callout task
http://ant.apache.org/manual/Tasks/java.html
你好
在下面的链接中,您将找到有关 izpack 安装程序的很好的帮助。
http://www.imrantariq.com/blog/?p=89
链接如下包含使用 izpack 制作安装程序的详细 pdf 文件。
http://www.imrantariq.com/blog/?attachment_id=112
为
伊姆兰 干杯塔里克
Hello
In the link below you will find a nice help about izpack installer.
http://www.imrantariq.com/blog/?p=89
Link below contains a detailed pdf to make installer with izpack.
http://www.imrantariq.com/blog/?attachment_id=112
cheers
Imran tariq
我已成功配置 IzPack 安装程序,该安装程序在安装过程中执行“bat”文件(带有一个参数)以生成许可证请求代码。首先,我必须确保将bat文件复制到用户选择的$INSTALL_PATH,并且在IzPack install.xml中,我在InstallPanel之后添加了一个ProcessPanel(这是复制所有文件,包括“bat”文件的地方) )。我的 ProcessPanel.Spec.xml 如下所示:
I have successfully configured an IzPack installer that executes a "bat" file (with one parameter) during installation to generate a license request code. First I had to make sure that the bat file was copied to the user's chosen $INSTALL_PATH, and in the IzPack install.xml I added a ProcessPanel after the InstallPanel (which is where all the files, including the "bat" one, gets copied). My ProcessPanel.Spec.xml looks like this: