You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Robert Mars <rm...@cisco.com> on 2002/01/30 19:42:41 UTC

How do I build an ant rule to run an inner class' main method?

E.G., I want to run "com.mycompany.mypackage.MyClass$Test".  The embedded
'$' is getting translated by ant.  Using &#36; doesn't solve this problem.
Escaping the dollar sign with a backslash results in ant translating the
backslash to a forward slash.

Here's the rule I'm trying to get working:

    <target name="test">
        <java classname="com.mycompany.mypackage.MyClass$Test">
            <classpath>
                <pathelement path="${java.class.path}"/>
            </classpath>
        </java>
    </target>


for:

pacakge com.mycompany.mypackage;

public class MyClass {
	...

	public static class Test {
		public static void main(String[] args) {
			// run tests
			...
		}
	}
}


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Can I run Ants from a Java Program?

Posted by Kevin Toomey <to...@yahoo.com>.
Check out the Ant API. You can use the Project class as your entry
point. 
--- Joseph Teo Chee Ming <Jo...@gemplus.com> wrote:
> Hi...
> 
> Sorry about the earlier mail...
> 
> Does anyone know if I can call Ants from a Java program? If so, how
> do I
> call? thanks...
> 
> Joe
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Can I run Ants from a Java Program?

Posted by Joseph Teo Chee Ming <Jo...@gemplus.com>.
Hi...

Sorry about the earlier mail...

Does anyone know if I can call Ants from a Java program? If so, how do I
call? thanks...

Joe


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Can I run ants from a .java program?

Posted by Joseph Teo Chee Ming <Jo...@gemplus.com>.

-----Original Message-----
From: KC Baltz [mailto:KBaltz@responsenetworks.com]
Sent: Thursday, January 31, 2002 6:27 AM
To: Ant Users List
Subject: Re: How do I build an ant rule to run an inner class' main
method?


Try $$ in place of $

K.C.

At 10:42 AM 1/30/02, you wrote:
>E.G., I want to run "com.mycompany.mypackage.MyClass$Test".  The embedded
>'$' is getting translated by ant.  Using &#36; doesn't solve this problem.
>Escaping the dollar sign with a backslash results in ant translating the
>backslash to a forward slash.
>
>Here's the rule I'm trying to get working:
>
>     <target name="test">
>         <java classname="com.mycompany.mypackage.MyClass$Test">
>             <classpath>
>                 <pathelement path="${java.class.path}"/>
>             </classpath>
>         </java>
>     </target>
>
>
>for:
>
>pacakge com.mycompany.mypackage;
>
>public class MyClass {
>         ...
>
>         public static class Test {
>                 public static void main(String[] args) {
>                         // run tests
>                         ...
>                 }
>         }
>}
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How do I build an ant rule to run an inner class' main method?

Posted by KC Baltz <KB...@responsenetworks.com>.
Try $$ in place of $

K.C.

At 10:42 AM 1/30/02, you wrote:
>E.G., I want to run "com.mycompany.mypackage.MyClass$Test".  The embedded
>'$' is getting translated by ant.  Using &#36; doesn't solve this problem.
>Escaping the dollar sign with a backslash results in ant translating the
>backslash to a forward slash.
>
>Here's the rule I'm trying to get working:
>
>     <target name="test">
>         <java classname="com.mycompany.mypackage.MyClass$Test">
>             <classpath>
>                 <pathelement path="${java.class.path}"/>
>             </classpath>
>         </java>
>     </target>
>
>
>for:
>
>pacakge com.mycompany.mypackage;
>
>public class MyClass {
>         ...
>
>         public static class Test {
>                 public static void main(String[] args) {
>                         // run tests
>                         ...
>                 }
>         }
>}
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>