You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Christopher Berry <ch...@etrade.com> on 2001/05/22 01:45:31 UTC
Setting a Unix vs Windows switch
Greetings,
The following build.xml -- running on a Windows 2000 box -- prints out::
Installing on a Windows 2000 machine
(is.Windows= ${is.Windows}) (is.Unix= true)
(isWindows 2000= true)
Can anyone point to my error???
Thanks,
-- Chris
=====================================
<property name="is${os.name}" value="true"/>
<target name="set_windows1" depends="init" if="${isWindows 2000}" >
<property name="is.Windows" value="true" />
</target>
<target name="set_windows2" depends="set_windows1" if="${isWindows NT}" >
<property name="is.Windows" value="true" />
</target>
<target name="set_windows3" depends="set_windows2" if="${isWindows 98}" >
<property name="is.Windows" value="true" />
</target>
<target name="set_unix" depends="set_windows3" unless="${is.Windows}" >
<property name="is.Unix" value="true" />
</target>
<target name="print_os" depends="set_unix">
<echo>
Installing on a ${os.name} machine
(is.Windows= ${is.Windows}) (is.Unix= ${is.Unix})
(isWindows 2000= ${isWindows 2000})
</echo>
</target>
Chris Berry --- christopher.berry@etrade.com -- 512-323-9479
Re: Jar file loading
Posted by Jim Cheesman <jc...@msl.es>.
At 04:00 PM 23/05/01, you wrote:
>Jim,
>
>Actually because of Windows.
Ah.... should have guessed! Further testing revealed that it didn't happen
on the Aix box we have here, although there was a different problem there,
which further adds to the confusion ;) On Aix, the classes are loaded
preferentially from the classpath, and then from ANT_HOME/lib, while on
Win2000 it's the other way round.
I spent hours tracing down why I was getting a deprecated warning for
org.xml.sax.Parser on Aix but not on my desktop machine: Win2000 was
loading parser.jar_ from lib, Aix was loading xerces.jar from my classpath,
and ignoring parser.jar in lib.
Still, if anyone needs a couple of utilities to trace down where a class is
being loaded from, I'm happy to share. (One's even defined as an ant task! ;)
Something to take note of for those of us using more than one
environment.... What can I expect to see if I move over to linux, for example?
Jim
--
* Jim Cheesman *
Trabajo:
jchees@msl.es - (34)(91) 724 9200 x 2360
On one hand, I'm
indecisive, but on the other, I'm not.
Re: Jar file loading
Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Jim,
Actually because of Windows. I think if you look for *.jar in a batch file,
the old 8.3 thing comes out to play and you find files with any extension
starting with jar. It is probably this line in ant.bat
for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" "%%i"
I tried this
for %%i in ("%ANT_HOME%\lib\*.jar") do echo "%%i"
with the following results
"F:\Software\Ant\lib\ant.jar"
"F:\Software\Ant\lib\ant.jaroobah"
"F:\Software\Ant\lib\crimson.jar"
"F:\Software\Ant\lib\jaxp.jar"
"F:\Software\Ant\lib\optional.jar"
Gotta love that 8.3 legacy.
Conor
----- Original Message -----
From: "Jim Cheesman" <jc...@msl.es>
To: <an...@jakarta.apache.org>
Sent: Wednesday, May 23, 2001 11:30 PM
Subject: Jar file loading
> If I rename a jar file (on Win2000) from x.jar to x.jar_ ant will load it
> (from ant\lib) correctly - yet if I name it x.txt (for example) it will
not.
>
>
> Is this because of ant or java? (Or is it correct behaviour?)
>
>
> Jim
>
>
>
>
> --
>
> * Jim Cheesman *
> Trabajo:
> jchees@msl.es - (34)(91) 724 9200 x 2360
> On one hand, I'm
> indecisive, but on the other, I'm not.
>
>
>
Jar file loading
Posted by Jim Cheesman <jc...@msl.es>.
If I rename a jar file (on Win2000) from x.jar to x.jar_ ant will load it
(from ant\lib) correctly - yet if I name it x.txt (for example) it will not.
Is this because of ant or java? (Or is it correct behaviour?)
Jim
--
* Jim Cheesman *
Trabajo:
jchees@msl.es - (34)(91) 724 9200 x 2360
On one hand, I'm
indecisive, but on the other, I'm not.
RE: Setting a Unix vs Windows switch
Posted by Mark Jaffe <mj...@eturn.com>.
Thanks to others' help, this is working for me (YMMV):
<property name="is.${os.name}" value="true"/>
<target name="init.win1" if="is.Windows NT" >
<property name="javahome" value="d:\jdk1.3" />
<property name="wlhome" value="d:\weblogic" />
<property name="cvswork" value="d:\cvswork" />
<property name="ejbjars" value="d:\EJBJarfiles" />
</target>
<target name="init.win2" if="is.Windows_NT" >
<property name="javahome" value="d:\jdk1.3" />
<property name="wlhome" value="d:\weblogic" />
<property name="cvswork" value="d:\cvswork" />
<property name="ejbjars" value="d:\EJBJarfiles" />
</target>
<target name="init.win3" if="is.Windows 2000" >
<property name="javahome" value="d:\jdk1.3" />
<property name="wlhome" value="d:\weblogic" />
<property name="cvswork" value="d:\cvswork" />
<property name="ejbjars" value="d:\EJBJarfiles" />
</target>
<target name="init.unix" if="is.SunOS" >
<property name="javahome" value="/usr/local/jdk1.3" />
<property name="wlhome" value="/usr/local/weblogic" />
<property name="cvswork" value="~/cvswork" />
<property name="ejbjars" value="~/EJBJarfiles" />
</target>
<target name="init" depends="init.win1,init.win2,init.win3,init.unix">
<tstamp>
<format property="now" pattern="mmdd"/>
<format property="DSTAMP" pattern="mm/dd/yyyy" />
</tstamp>
<echo message="Checking environment"/>
<echo message=" OS = ${os.name}" />
<echo message=" Java = ${javahome}" />
<echo message=" Weblogic = ${wlhome}" />
<echo message=" work dir = ${cvswork}" />
<echo message=" ejbjars = ${ejbjars}" />
<echo message=" version = ${vers}" />
</target>
-----Original Message-----
From: Christopher Berry [mailto:christopher.berry@etrade.com]
Sent: Monday, May 21, 2001 4:46 PM
To: Ant-User (E-mail)
Subject: Setting a Unix vs Windows switch
Greetings,
The following build.xml -- running on a Windows 2000 box -- prints out::
Installing on a Windows 2000 machine
(is.Windows= ${is.Windows}) (is.Unix= true)
(isWindows 2000= true)
Can anyone point to my error???
Thanks,
-- Chris
=====================================
<property name="is${os.name}" value="true"/>
<target name="set_windows1" depends="init" if="${isWindows 2000}" >
<property name="is.Windows" value="true" />
</target>
<target name="set_windows2" depends="set_windows1" if="${isWindows NT}" >
<property name="is.Windows" value="true" />
</target>
<target name="set_windows3" depends="set_windows2" if="${isWindows 98}" >
<property name="is.Windows" value="true" />
</target>
<target name="set_unix" depends="set_windows3" unless="${is.Windows}" >
<property name="is.Unix" value="true" />
</target>
<target name="print_os" depends="set_unix">
<echo>
Installing on a ${os.name} machine
(is.Windows= ${is.Windows}) (is.Unix= ${is.Unix})
(isWindows 2000= ${isWindows 2000})
</echo>
</target>
Chris Berry --- christopher.berry@etrade.com -- 512-323-9479
Re: Setting a Unix vs Windows switch
Posted by Diane Holt <ho...@yahoo.com>.
When referencing a property in the if/unless attribute, use just the
property name (ie., no ${...}).
Diane
--- Christopher Berry <ch...@etrade.com> wrote:
> Greetings,
>
> The following build.xml -- running on a Windows 2000 box -- prints out::
>
> Installing on a Windows 2000 machine
> (is.Windows= ${is.Windows}) (is.Unix= true)
> (isWindows 2000= true)
>
> Can anyone point to my error???
> Thanks,
> -- Chris
>
> =====================================
> <property name="is${os.name}" value="true"/>
>
> <target name="set_windows1" depends="init" if="${isWindows 2000}" >
> <property name="is.Windows" value="true" />
> </target>
> <target name="set_windows2" depends="set_windows1" if="${isWindows
> NT}" >
> <property name="is.Windows" value="true" />
> </target>
> <target name="set_windows3" depends="set_windows2" if="${isWindows
> 98}" >
> <property name="is.Windows" value="true" />
> </target>
> <target name="set_unix" depends="set_windows3" unless="${is.Windows}"
> >
> <property name="is.Unix" value="true" />
> </target>
>
> <target name="print_os" depends="set_unix">
> <echo>
> Installing on a ${os.name} machine
> (is.Windows= ${is.Windows}) (is.Unix= ${is.Unix})
> (isWindows 2000= ${isWindows 2000})
> </echo>
> </target>
>
> Chris Berry --- christopher.berry@etrade.com -- 512-323-9479
>
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/