ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clifton C. Craig" <...@icsaward.com>
Subject Re: task <java ...fork="true">: from which directory is the java command started
Date Tue, 27 Jan 2004 16:23:43 GMT
Rudolf,

I just read a few mails back and saw your earlier question. I believe 
you want the following:

<target name="hsqldb" description="Start the HSQLB sample database">
   <java classname="org.hsqldb.Server" fork="true" dir="${db.dir}" 
failonerror="true"
maxmemory="128m" >
      <arg value="-database testxyz"/>
      <classpath><pathelement 
location="${lib.home}/hsqldb.jar"/></classpath>
    </java>
</target>

Where ${db.dir} is a property you can set either interactively via input 
task or via another Ant task like <property>. You can query the working 
directory via the system property user.dir. (eg. 
System.getProperty("user.dir");) Use this to provide basic error 
trapping within your Server class.

Cliff

Rudolf Nottrott wrote:

> Thanks Antoine for the suggestion, but it doesn't seem to make a 
> difference.
>
> Basically, I need to make sure that the command
>
> 'java org.hsqldb.Server -database testxyz'
>
> which is run by the ant target below, is started from the current 
> directory, the directory in which the database files are.
>
> How can I control the directory in which a  <java task gets started?  
> Is there a parameter for that?
>
> Thanks,
> Rudolf
>
>
> At 08:53 AM 1/20/2004 +0100, you wrote:
>
>> You probably want 2 arguments :
>> <arg value="-database"/>
>> <arg value="testxyz"/>
>>
>> Antoine
>
>
>> Rudolf Nottrott wrote:
>>
>>> Hi,
>>>
>>> I have an Ant <java...> task that runs a database program named 
>>> org.hsqldb.Server, see below.  The argument  to the Server is a 
>>> database name, "-database testxyz".  The database testxyz.* is 
>>> supposed to be taken from (or created in) the directory you were in 
>>> when you issued the Java command that started the database Server.
>>> Now, I didn't start Java -- I started Ant which started Java.
>>>
>>> Here is the task:
>>> <target name="hsqldb" description="Start the HSQLB sample database">
>>>    <java classname="org.hsqldb.Server" fork="true" failonerror="true"
>>> maxmemory="128m" >
>>>       <arg value="-database testxyz"/>
>>>       <classpath><pathelement 
>>> location="${lib.home}/hsqldb.jar"/></classpath>
>>>     </java>
>>> </target>
>>>
>>> The server starts up ok, but I'm not getting the database I want, 
>>> testxyz, and so I'm trying to verify  the directory from which the 
>>> Java command of task <java ...> was issued.
>>> Any ideas on how trace this?  Is there perhaps some task like "print 
>>> working directory" that I could run in conjunction with the <java 
>>> ... > task?
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message