如何在Ant中添加相当于java -D的系统属性 [英] How to add system property equivalent to java -D in Ant

查看:28
本文介绍了如何在Ant中添加相当于java -D的系统属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要设置 java -Djava.library.path=/some/path 并且我想在运行 ant 脚本、构建 jar 时执行此操作.

I need to set java -Djava.library.path=/some/path and I want to do it when I am running my ant script, building my jar.

我想我必须使用

<sysproperty key="java.library.path" value="/some/path"/>

但它不起作用.我无法使语法起作用.我在谷歌上搜索并发现的唯一一件事是 sysproperty 与

but it doesnt work. I cannot make the syntax work. The only thing I have Googled and found is sysproperty in conjunction with

 <java classname>

但这对我来说没有任何意义.

but that doesnt make any sense to me.

我不确定这是否相关,但我正在使用 ant 创建一个耳朵并在 JBoss 中部署这个耳朵.

I am not sure if this is relevant, but I am using ant to create a ear and deploying this ear in JBoss.

推荐答案

这里是一个示例 Ant 目标 run,它执行 example.jar 并传递一个系统属性key="java.library.path"value="/some/path":

Here is an example Ant target run that executes the example.jar and passes a system property with key="java.library.path" and value="/some/path":

<target name="run">
    <java jar="example.jar" fork="true">
        <jvmarg value="-Djava.library.path=/some/path"/>
    </java>
</target>

这篇关于如何在Ant中添加相当于java -D的系统属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆