Hi, Sorry I sent the reply too quick.
Simplest way for you would be to use: java -classpath "D:\Software\webtest\lib\ant-launcher.jar" org.apache.tools.ant.launch.Launcher <cli args to ant> <cli args to ant> - eg -debug or -version ... Sorry about providing so much info since I realized that your case is simpler than mine. Also I just assume that you have, ant-launcher.jar, in "D:\Software\webtest\lib\". Your path must of course be where your "launcher.jar" exists. Br, //mikael -----Original Message----- From: Gabriel Petrovay [mailto:gabipetro...@gmail.com] Sent: den 9 februari 2011 13:47 To: Ant Users List Subject: Re: Run ant with java from Powershell I have no notion of ANT_HOME. Ant is only in jars in other products like: webtest or eclipse. I only have the location where anr jars are: MY_ANT_JAR_LOCATION I can do: java -classpath "%MY_ANT_JAR_LOCATION%\ant-launcher.jar" ???? org.apache.tools.ant.launch.Launcher So in your case I don't know what "-Dant.home=%ANT_HOME%" means or translates. What comes instead of ???? I also don't understand what is the role of each of: -cp "%CLASSPATH%" and -classpath "%ANT_HOME%\lib\ant-launcher.jar" Also what is the difference between: %ANT_ARGS% and %ANT_CMD_LINE_ARGS% Thanks! PS: I only need a way to run java with all the jars in a directory in the classpath. I don't care if I run ant Launcher or Main class. java -cp "D:\Software\webtest\lib\*" org.apache.tools.ant.Main This is because jars have versions in them that change and this is supposed to be in a nightly script. On Wed, Feb 9, 2011 at 1:21 PM, Mikael Petterson <mikael.petter...@ericsson.com> wrote: > Hi, > > Why not try: > > java %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" > "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher > %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% > > -----Original Message----- > From: Gabriel Petrovay [mailto:gabipetro...@gmail.com] > Sent: den 9 februari 2011 13:07 > To: user@ant.apache.org > Subject: Run ant with java from Powershell > > Hi! > > Did somebody manage to launch ant form the ant.jar with java? I cannot make > it work. I must include all the jars in a certain directory in the classpath. > > Using java 6, I tried: > > java -cp "D:\Software\webtest\lib\*" org.apache.tools.ant.Main > > and I get: > > Exception in thread "main" java.lang.NoClassDefFoundError: > D:\Software\webtest\lib\ant-1/7/0/jar > Caused by: java.lang.ClassNotFoundException: > D:\Software\webtest\lib\ant-1.7.0.jar > at java.net.URLClassLoader$1.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(Unknown Source) > at java.lang.ClassLoader.loadClass(Unknown Source) > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > at java.lang.ClassLoader.loadClass(Unknown Source) > > So, probably "D:\Software\webtest\lib\*" gets expanded using spaces between > the path items instead of columns (;). > > > Any ideas? > > Thanks! > > -- > MSc Gabriel Petrovay > Mobile: +41(0)787978034 > www.28msec.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional > commands, e-mail: user-h...@ant.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional > commands, e-mail: user-h...@ant.apache.org > > -- MSc Gabriel Petrovay Mobile: +41(0)787978034 www.28msec.com --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org