如何添加系统属性等同于Java的蚂蚁-D [英] How to add system property equivalent to java -D in Ant

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

问题描述

我需要设置的的java -Djava.library.path = /一些/路径的,我想这样做,当我跑我的ant脚本,构建我的罐子。

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"/>

但它不工作。我不能使语法的工作。我用Google搜索,发现的唯一的事情就是会同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.

我不知道这是否是相关的,但我使用蚂蚁创造了耳朵和部署这款耳塞在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目标运行的执行 example.jar 并通过与键=的java.library.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>

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

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