You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Rudolf Nottrott <rn...@alexandria.UCSB.edu> on 2004/01/20 03:21:34 UTC
task : from which directory is the java
command started
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?
Thanks,
Rudolf Nottrott
UCSB
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: task : from which directory is the java
command started
Posted by Antoine Lévy-Lambert <an...@antbuild.com>.
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
>
>
>
>
From the manual, there is a "dir" attribute for the javac task. Note
that it requires also fork="true", otherwise it is ignored.
Antoine
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: task : from which directory is the java
command started
Posted by "Clifton C. Craig" <cc...@icsaward.com>.
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
Re: task : from which directory is the
java command started
Posted by Rudolf Nottrott <rn...@alexandria.UCSB.edu>.
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
Re: task : from which directory is the java
command started
Posted by Antoine Lévy-Lambert <an...@antbuild.com>.
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?
>
>
You probably want 2 arguments :
<arg value="-database"/>
<arg value="testxyz"/>
Antoine
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org