Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add system property equivalent to java -D in 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.

I think I have to use

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

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.

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

like image 754
Shervin Asgari Avatar asked Mar 04 '10 10:03

Shervin Asgari


2 Answers

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>
like image 76
dokaspar Avatar answered Oct 14 '22 05:10

dokaspar


did you try to run

ant -Djava.library.path=/some/path ...  ?
like image 20
Omry Yadan Avatar answered Oct 14 '22 05:10

Omry Yadan