You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Scassa <ds...@journee.com> on 2001/05/09 20:31:18 UTC

sysproperty="x" value="y" --> Order of Operation

PROBLEM SUMMARY:

While trying to execute JETACE, ANT seems to want to set the system
properties first and all other arguments, including the classpath second. Is
there a way around this? See Error Below.

MY VARS:

${ejb_temp} = ./ejb_temp

${forkingclass} =
/lib/ujc.jar;./lib/xml4j.jar;./lib/jetace.jar;./lib/ivbjfaceall.jar;./ejb_te
mp;./lib/jaxp.jar

MY BUILD.XML TARGET FOR JETACE:

<java classname="com.ibm.ejb.jetjar.JetAceMain" fork="yes">
	<classpath path="${forkingclass}"/>
	<sysproperty key="JETACE_WORK_DIR" value="${ejb_temp}"/>
	<arg value="./xml/BeanDescriptor.xml"/>
</java>

THE EXECUTION:
"c:/ejbtest/>ant -buildfile whywontthiswork.xml jetace"

THE BUILD OUTPUT:

jetace:
	[java] Forking java -DJETACE_WORK_DIR=./ejb_temp -classpath
D:\ejbtemp\ejb_
temp;D:\ejbtemp\lib\ujc.jar;D:\ejbtemp\lib\xml4j.jar;D:\ejbtemp\lib\jetace.j
ar;D
:\ejbtemp\lib\ivbjfaceall.jar;D:\ejbtemp\lib\jaxp.jar
com.ibm.ejb.jetjar.JetAceM
ain ./xml/BeanDescriptor.xml
Execute:CommandLauncher: java -DJETACE_WORK_DIR=./ejb_temp -classpath
D:\ejbtemp
\ejb_temp;D:\ejbtemp\lib\ujc.jar;D:\ejbtemp\lib\xml4j.jar;D:\ejbtemp\lib\jet
ace.
jar;D:\ejbtemp\lib\ivbjfaceall.jar;D:\ejbtemp\lib\jaxp.jar
com.ibm.ejb.jetjar.Je
tAceMain ./xml/BeanDescriptor.xml
     [java] Error: the JETACE_WORK_DIR directory is not on the CLASSPATH.
     [java] Java Result: 1

I find this works if I manually execute this from the cmd line:

java -cp
/lib/ujc.jar;./lib/xml4j.jar;./lib/jetace.jar;./lib/ivbjfaceall.jar;./ejb_te
mp;./lib/jaxp.jar -DJETACE_WORK_DIR=./ejb_temp com.ibm.ejb.jetjar.JetAceMain
./xml/BeanDescriptor.xml

-Dave

Re: sysproperty="x" value="y" --> Order of Operation

Posted by Stefan Bodewig <bo...@apache.org>.
David Scassa <ds...@journee.com> wrote:

> While trying to execute JETACE, ANT seems to want to set the system
> properties first and all other arguments, including the classpath
> second.

This shouldn't make any difference to JETACE as boith, setting the
system properties and resolving the classpath has been done by the JVM
before the very first class of JETACE even gets loaded.

I think, your problem is not related to the order of the JVM arguments:

> ${ejb_temp} = ./ejb_temp
> 
> ${forkingclass} =
> /lib/ujc.jar;./lib/xml4j.jar;./lib/jetace.jar;./lib/ivbjfaceall.jar;./ejb_te
> mp;./lib/jaxp.jar
> 
> MY BUILD.XML TARGET FOR JETACE:
> 
> <java classname="com.ibm.ejb.jetjar.JetAceMain" fork="yes">
> 	<classpath path="${forkingclass}"/>
> 	<sysproperty key="JETACE_WORK_DIR" value="${ejb_temp}"/>
> 	<arg value="./xml/BeanDescriptor.xml"/>
> </java>
> 
> THE EXECUTION:
> "c:/ejbtest/>ant -buildfile whywontthiswork.xml jetace"
> 
> THE BUILD OUTPUT:
> 
> Forking java -DJETACE_WORK_DIR=./ejb_temp -classpath D:\ejbtemp\ejb_temp ....

Probably (I don't know JETACE) this makes JETACE_WORK_DIR to be
interpreted as c:/ejbtest/ejb_temp (as you run the command on C:) and
this one is not in your CLASSPATH as far as I can see.

If you want Ant to resolve ${ejb_temp} as relative to your project's
basedir, use the file attribute of sysproperty instead of the value
attribute.

Stefan