You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Salman, Afzal" <Af...@WorldChain.com> on 2001/06/19 03:00:27 UTC

Translating exec to java!

I translated following command into ANT:-

java -classpath %WL_HOME%/lib/weblogic_sp.jar;%WL_HOME%/lib/weblogic.jar
weblogic.ejbc -compile javac input_app.jar output_app.jar

as follows.  It works fine when I translate it into Ant as follows using the
exec:

<target name="createEjb" depends="package_ejb">
  <exec dir="${APP_DIR}" executable="java" >
    <arg line="-classpath ${wl_jar1};${wl_jar2};${PLATFORM_CLASSPATH}
${wl_ejbc} -compiler javac ${in_jar} ${out_jar}"/>
  </exec>
</target>

But it does not work when I use java as follows as the output_app.jar is
only 1KB.

<target name="createEjb_jar" depends="package_ejb">
  <java fork="yes" classpath="${wl_jar1}:${wl_jar2}" output="output_app.jar"
classname="weblogic.ejbc" >
	<arg value="-compile javac input_app.jar"/>
  </java>
</target>


I want to know:

1.	Is it possible to translate the above java command into Ant using
Ant's java function?  
2.	Is there something which I am missing in <java fork="yes" ...
translation?

Thanks in advance.

Afz


-------------------------------------------------------------------------- 
Note:  The information contained in this message may be privileged and
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this communication is
strictly prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and deleting it from
your computer. Thank you. 
--------------------------------------------------------------------------

RE: Translating exec to java!

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
> From: Salman, Afzal [mailto:Afzal.Salman@WorldChain.com]
> Sent: Tuesday, 19 June 2001 11:00 AM
> To: Ant-User (E-mail)
> Subject: Translating exec to java!
>
>
> I translated following command into ANT:-
>
> java -classpath %WL_HOME%/lib/weblogic_sp.jar;%WL_HOME%/lib/weblogic.jar
> weblogic.ejbc -compile javac input_app.jar output_app.jar
>
> as follows.  It works fine when I translate it into Ant as
> follows using the
> exec:
>
> <target name="createEjb" depends="package_ejb">
>   <exec dir="${APP_DIR}" executable="java" >
>     <arg line="-classpath ${wl_jar1};${wl_jar2};${PLATFORM_CLASSPATH}
> ${wl_ejbc} -compiler javac ${in_jar} ${out_jar}"/>
>   </exec>
> </target>
>
> But it does not work when I use java as follows as the output_app.jar is
> only 1KB.
>
> <target name="createEjb_jar" depends="package_ejb">
>   <java fork="yes" classpath="${wl_jar1}:${wl_jar2}"
> output="output_app.jar"
> classname="weblogic.ejbc" >
> 	<arg value="-compile javac input_app.jar"/>
>   </java>
> </target>
>

Afzal,

The use of the output attribute for <java> is incorrect. This will take the
output, ie. the messages, generated by javac and put them in a file. It
won't be a jar. Your arg lines are different - you are using "-compiler" in
one and "-compile" in another. Finally, you need to use either an <arg line>
in the <java> command, similar to what you have done for the <exec>, or you
need to use multiple <arg value> elements, one per argument.

Have a read here
http://jakarta.apache.org/ant/manual/using.html#arg


>