You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Scott Powell <sc...@yahoo.com> on 2004/07/19 16:14:31 UTC

Cannot get Ant to work. Error message is java.lang.InstantationException: org.apache.tools.ant.Main

Hi,

I've downloaded Ant twice (version 1.6.1 and 1.6.2).

My environment variables are:
CLASSPATH includes both c:\ant\lib and c:\ant\bin.
ANT_HOME is c:\ant
JAVA_HOME is c:\Program Files\Java\j2sdk1.4.2\

Other Java apps, like Poseidon, JBuilder, Eclipse and
JRun all work fine.

But I cannot get Ant to run.  I get this error message
every time:

java.lang.InstantationException:
org.apache.tools.ant.Main
    at java.lang.Class.newInstance0(Class.java:293)
    at java.lang.Class.newInstance(Class.java:261)
    at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
    at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

I have tried both the BIN distribution and the source
code distribution.  With the source code, I've used
the included build script. 

I have also tried compiling with both Eclipse and
JBuilder X -- both reported many compilation errors
(though I don't know enough Java to say the errors
were in the code and not how I organized the
projects).  When I tried to debug within Eclipse, I
basically got the same error message.

Any advice on how to get Ant working?

Also, it would be neat to understand how to get a
clean build in JBX or Eclipse (just to give the tools
a chance to build something more elaborate than
"Hello, World ... have a nice day!"

Thanks
Scott



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


RE: Cannot get Ant to work. Error message is java.lang.InstantationException: org.apache.tools.ant.Main

Posted by Duke Tantiprasut <du...@resolve-systems.com>.
You might want to check out the eclipse ant settings. I detects the ant jars
when you first install it. You may need to remove and point to the new jars
and any ant-contrib jars that you use. The settings ss under the eclipse
preferences.

> -----Original Message-----
> From: Scott Powell [mailto:scotthpowell@yahoo.com] 
> Sent: Monday, July 19, 2004 8:21 AM
> To: Ant Users List
> Subject: Re: Cannot get Ant to work. Error message is 
> java.lang.InstantationException: org.apache.tools.ant.Main
> 
> Wow -- that did get it to run.
> 
> I would typically run the script from within Eclipse, which 
> might be a problem if I have to erase the classpath every time.
> 
> So how can I root out any old versions of ant?  Is it 
> definitely a classpath setting or is it possible my path 
> setting is a problem?
> 
> Thanks
> Scott
> 
> <ra...@yahoo.com> wrote:
> > Hi,
> > 0) First of all, check if you have another version of ant 
> installed on 
> > your machine. If you have remove it from your PATH.
> > 1) unset CLASSPATH
> > 2) invoke %ANT_HOME%\bin\ant - it should pickup its CLASSPATH 
> > correctly
> > 
> > --- Scott Powell <sc...@yahoo.com> wrote:
> > > Hi,
> > > 
> > > I've downloaded Ant twice (version 1.6.1 and
> > 1.6.2).
> > > 
> > > My environment variables are:
> > > CLASSPATH includes both c:\ant\lib and c:\ant\bin.
> > > ANT_HOME is c:\ant
> > > JAVA_HOME is c:\Program Files\Java\j2sdk1.4.2\
> > > 
> > > Other Java apps, like Poseidon, JBuilder, Eclipse and 
> JRun all work 
> > > fine.
> > > 
> > > But I cannot get Ant to run.  I get this error message every time:
> > > 
> > > java.lang.InstantationException:
> > > org.apache.tools.ant.Main
> > >     at
> > java.lang.Class.newInstance0(Class.java:293)
> > >     at java.lang.Class.newInstance(Class.java:261)
> > >     at
> > >
> >
> org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
> > >     at
> > >
> >
> org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
> > > 
> > > I have tried both the BIN distribution and the source code 
> > > distribution.  With the source code, I've
> > used
> > > the included build script. 
> > > 
> > > I have also tried compiling with both Eclipse and 
> JBuilder X -- both 
> > > reported many compilation
> > errors
> > > (though I don't know enough Java to say the errors were 
> in the code 
> > > and not how I organized the projects).  When I tried to 
> debug within 
> > > Eclipse,
> > I
> > > basically got the same error message.
> > > 
> > > Any advice on how to get Ant working?
> > > 
> > > Also, it would be neat to understand how to get a clean 
> build in JBX 
> > > or Eclipse (just to give the tools a chance to build 
> something more 
> > > elaborate than "Hello, World ... have a nice day!"
> > > 
> > > Thanks
> > > Scott
> > > 
> > > 
> > > 
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam protection around 
> > > http://mail.yahoo.com
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail:
> > > user-help@ant.apache.org
> > > 
> > > 
> > 
> > 
> > 
> > 		
> > __________________________________
> > Do you Yahoo!?
> > New and Improved Yahoo! Mail - Send 10MB messages!
> > http://promotions.yahoo.com/new_mail
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > user-help@ant.apache.org
> > 
> > 
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Vote for the stars of Yahoo!'s next ad campaign!
> http://advision.webevents.yahoo.com/yahoo/votelifeengine/
> 
> 
> ---------------------------------------------------------------------
> 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: Cannot get Ant to work. Error message is java.lang.InstantationException: org.apache.tools.ant.Main

Posted by Scott Powell <sc...@yahoo.com>.
--- Ivan Ivanov <ra...@yahoo.com> wrote:
> --- Scott Powell <sc...@yahoo.com> wrote:
> > Wow -- that did get it to run.
> > 
> > I would typically run the script from within
> > Eclipse,
> > which might be a problem if I have to erase the
> > classpath every time.
> Do you mean that you run ant.bat from Eclispe? If
> so,
> it is very strange way to run ant from Eclipse. I
> use
> Eclispe too and it usually comes with preconfigured
> Ant with. It also be configured to use another ant
> installation.
> 

I just pick "run as ant script" basically from within
Eclipse.  I don't know if that runs ant.bat or not. 
But it was giving me a similar error message.  It
seems there's a way to explicitly configure Eclipse's
Ant integration and that might resolve the problem
from within that IDE.



> > 
> > So how can I root out any old versions of ant?  Is
> > it
> > definitely a classpath setting or is it possible
> my
> > path setting is a problem?

> I do not know what was the problem in your case. I
> only know that ant starts scripts are responsible
> for
> building ant classpath, which is used to start and
> run
> ant. And if my application requires another jars I
> configure the classpath in the application's
> build.xml. I never set CLASSPATH as an environment
> variable when using ant - it makes me a little
> nervous
> and this prevents me from that issues of your kind.
> As for PATH problems, you can expect your PATH to
> see
> what is included in it say with
> echo %PATH%
> You can also use the command 'which' to see where
> ant.bat is picked from but in this case you must
> download which.exe

I'll look into this some more.  I moved the Ant
classpath reference to the front of the list and it
worked fine without clearing out the classpath
environment variable entirely.

Thanks to your response about an old Ant install
messing things up, I will scan my system for all
ant.jar files and adjust things to only use the new
downloaded-straight-from-apache Ant deployment.

Thanks 

> > 
> > Thanks
> > Scott
> > 
> > <ra...@yahoo.com> wrote:
> > > Hi,
> > > 0) First of all, check if you have another
> version
> > > of
> > > ant installed on your machine. If you have
> remove
> > it
> > > from your PATH.
> > > 1) unset CLASSPATH
> > > 2) invoke %ANT_HOME%\bin\ant - it should pickup
> > its
> > > CLASSPATH correctly
> > > 
> > > --- Scott Powell <sc...@yahoo.com> wrote:
> > > > Hi,
> > > > 
> > > > I've downloaded Ant twice (version 1.6.1 and
> > > 1.6.2).
> > > > 
> > > > My environment variables are:
> > > > CLASSPATH includes both c:\ant\lib and
> > c:\ant\bin.
> > > > ANT_HOME is c:\ant
> > > > JAVA_HOME is c:\Program Files\Java\j2sdk1.4.2\
> > > > 
> > > > Other Java apps, like Poseidon, JBuilder,
> > Eclipse
> > > > and
> > > > JRun all work fine.
> > > > 
> > > > But I cannot get Ant to run.  I get this error
> > > > message
> > > > every time:
> > > > 
> > > > java.lang.InstantationException:
> > > > org.apache.tools.ant.Main
> > > >     at
> > > java.lang.Class.newInstance0(Class.java:293)
> > > >     at
> > java.lang.Class.newInstance(Class.java:261)
> > > >     at
> > > >
> > >
> >
>
org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
> > > >     at
> > > >
> > >
> >
>
org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
> > > > 
> > > > I have tried both the BIN distribution and the
> > > > source
> > > > code distribution.  With the source code, I've
> > > used
> > > > the included build script. 
> > > > 
> > > > I have also tried compiling with both Eclipse
> > and
> > > > JBuilder X -- both reported many compilation
> > > errors
> > > > (though I don't know enough Java to say the
> > errors
> > > > were in the code and not how I organized the
> > > > projects).  When I tried to debug within
> > Eclipse,
> > > I
> > > > basically got the same error message.
> > > > 
> > > > Any advice on how to get Ant working?
> > > > 
> > > > Also, it would be neat to understand how to
> get
> > a
> > > > clean build in JBX or Eclipse (just to give
> the
> > > > tools
> > > > a chance to build something more elaborate
> than
> > > > "Hello, World ... have a nice day!"
> > > > 
> > > > Thanks
> > > > Scott
> > > > 
> > > > 
> > > > 
> > > >
> > __________________________________________________
> > > > Do You Yahoo!?
> > > > Tired of spam?  Yahoo! Mail has the best spam
> > > > protection around 
> > > > http://mail.yahoo.com 
> > > > 
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > user-unsubscribe@ant.apache.org
> > > > For additional commands, e-mail:
> > > > user-help@ant.apache.org
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > 		
> > > __________________________________
> > > Do you Yahoo!?
> > > New and Improved Yahoo! Mail - Send 10MB
> messages!
> > > http://promotions.yahoo.com/new_mail 
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail:
> > > user-help@ant.apache.org
> > > 
> > > 
> > 
> > 
> > 
> > 		
> > __________________________________
> > Do you Yahoo!?
> > Vote for the stars of Yahoo!'s next ad campaign!
> >
>
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > user-help@ant.apache.org
> > 
> > 
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Vote for the stars of Yahoo!'s next ad campaign!
>
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
=== message truncated ===



		
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/


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


Re: Cannot get Ant to work. Error message is java.lang.InstantationException: org.apache.tools.ant.Main

Posted by Ivan Ivanov <ra...@yahoo.com>.
--- Scott Powell <sc...@yahoo.com> wrote:
> Wow -- that did get it to run.
> 
> I would typically run the script from within
> Eclipse,
> which might be a problem if I have to erase the
> classpath every time.
Do you mean that you run ant.bat from Eclispe? If so,
it is very strange way to run ant from Eclipse. I use
Eclispe too and it usually comes with preconfigured
Ant with. It also be configured to use another ant
installation.

> 
> So how can I root out any old versions of ant?  Is
> it
> definitely a classpath setting or is it possible my
> path setting is a problem?
I do not know what was the problem in your case. I
only know that ant starts scripts are responsible for
building ant classpath, which is used to start and run
ant. And if my application requires another jars I
configure the classpath in the application's
build.xml. I never set CLASSPATH as an environment
variable when using ant - it makes me a little nervous
and this prevents me from that issues of your kind.
As for PATH problems, you can expect your PATH to see
what is included in it say with
echo %PATH%
You can also use the command 'which' to see where
ant.bat is picked from but in this case you must
download which.exe


> 
> Thanks
> Scott
> 
> <ra...@yahoo.com> wrote:
> > Hi,
> > 0) First of all, check if you have another version
> > of
> > ant installed on your machine. If you have remove
> it
> > from your PATH.
> > 1) unset CLASSPATH
> > 2) invoke %ANT_HOME%\bin\ant - it should pickup
> its
> > CLASSPATH correctly
> > 
> > --- Scott Powell <sc...@yahoo.com> wrote:
> > > Hi,
> > > 
> > > I've downloaded Ant twice (version 1.6.1 and
> > 1.6.2).
> > > 
> > > My environment variables are:
> > > CLASSPATH includes both c:\ant\lib and
> c:\ant\bin.
> > > ANT_HOME is c:\ant
> > > JAVA_HOME is c:\Program Files\Java\j2sdk1.4.2\
> > > 
> > > Other Java apps, like Poseidon, JBuilder,
> Eclipse
> > > and
> > > JRun all work fine.
> > > 
> > > But I cannot get Ant to run.  I get this error
> > > message
> > > every time:
> > > 
> > > java.lang.InstantationException:
> > > org.apache.tools.ant.Main
> > >     at
> > java.lang.Class.newInstance0(Class.java:293)
> > >     at
> java.lang.Class.newInstance(Class.java:261)
> > >     at
> > >
> >
>
org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
> > >     at
> > >
> >
>
org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
> > > 
> > > I have tried both the BIN distribution and the
> > > source
> > > code distribution.  With the source code, I've
> > used
> > > the included build script. 
> > > 
> > > I have also tried compiling with both Eclipse
> and
> > > JBuilder X -- both reported many compilation
> > errors
> > > (though I don't know enough Java to say the
> errors
> > > were in the code and not how I organized the
> > > projects).  When I tried to debug within
> Eclipse,
> > I
> > > basically got the same error message.
> > > 
> > > Any advice on how to get Ant working?
> > > 
> > > Also, it would be neat to understand how to get
> a
> > > clean build in JBX or Eclipse (just to give the
> > > tools
> > > a chance to build something more elaborate than
> > > "Hello, World ... have a nice day!"
> > > 
> > > Thanks
> > > Scott
> > > 
> > > 
> > > 
> > >
> __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > > protection around 
> > > http://mail.yahoo.com 
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail:
> > > user-help@ant.apache.org
> > > 
> > > 
> > 
> > 
> > 
> > 		
> > __________________________________
> > Do you Yahoo!?
> > New and Improved Yahoo! Mail - Send 10MB messages!
> > http://promotions.yahoo.com/new_mail 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > user-help@ant.apache.org
> > 
> > 
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Vote for the stars of Yahoo!'s next ad campaign!
>
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/


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


Re: Cannot get Ant to work. Error message is java.lang.InstantationException: org.apache.tools.ant.Main

Posted by Scott Powell <sc...@yahoo.com>.
Wow -- that did get it to run.

I would typically run the script from within Eclipse,
which might be a problem if I have to erase the
classpath every time.

So how can I root out any old versions of ant?  Is it
definitely a classpath setting or is it possible my
path setting is a problem?

Thanks
Scott

<ra...@yahoo.com> wrote:
> Hi,
> 0) First of all, check if you have another version
> of
> ant installed on your machine. If you have remove it
> from your PATH.
> 1) unset CLASSPATH
> 2) invoke %ANT_HOME%\bin\ant - it should pickup its
> CLASSPATH correctly
> 
> --- Scott Powell <sc...@yahoo.com> wrote:
> > Hi,
> > 
> > I've downloaded Ant twice (version 1.6.1 and
> 1.6.2).
> > 
> > My environment variables are:
> > CLASSPATH includes both c:\ant\lib and c:\ant\bin.
> > ANT_HOME is c:\ant
> > JAVA_HOME is c:\Program Files\Java\j2sdk1.4.2\
> > 
> > Other Java apps, like Poseidon, JBuilder, Eclipse
> > and
> > JRun all work fine.
> > 
> > But I cannot get Ant to run.  I get this error
> > message
> > every time:
> > 
> > java.lang.InstantationException:
> > org.apache.tools.ant.Main
> >     at
> java.lang.Class.newInstance0(Class.java:293)
> >     at java.lang.Class.newInstance(Class.java:261)
> >     at
> >
>
org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
> >     at
> >
>
org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
> > 
> > I have tried both the BIN distribution and the
> > source
> > code distribution.  With the source code, I've
> used
> > the included build script. 
> > 
> > I have also tried compiling with both Eclipse and
> > JBuilder X -- both reported many compilation
> errors
> > (though I don't know enough Java to say the errors
> > were in the code and not how I organized the
> > projects).  When I tried to debug within Eclipse,
> I
> > basically got the same error message.
> > 
> > Any advice on how to get Ant working?
> > 
> > Also, it would be neat to understand how to get a
> > clean build in JBX or Eclipse (just to give the
> > tools
> > a chance to build something more elaborate than
> > "Hello, World ... have a nice day!"
> > 
> > Thanks
> > Scott
> > 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> > protection around 
> > http://mail.yahoo.com 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > user-help@ant.apache.org
> > 
> > 
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/


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


Re: Cannot get Ant to work. Error message is java.lang.InstantationException: org.apache.tools.ant.Main

Posted by Ivan Ivanov <ra...@yahoo.com>.
Hi,
0) First of all, check if you have another version of
ant installed on your machine. If you have remove it
from your PATH.
1) unset CLASSPATH
2) invoke %ANT_HOME%\bin\ant - it should pickup its
CLASSPATH correctly

--- Scott Powell <sc...@yahoo.com> wrote:
> Hi,
> 
> I've downloaded Ant twice (version 1.6.1 and 1.6.2).
> 
> My environment variables are:
> CLASSPATH includes both c:\ant\lib and c:\ant\bin.
> ANT_HOME is c:\ant
> JAVA_HOME is c:\Program Files\Java\j2sdk1.4.2\
> 
> Other Java apps, like Poseidon, JBuilder, Eclipse
> and
> JRun all work fine.
> 
> But I cannot get Ant to run.  I get this error
> message
> every time:
> 
> java.lang.InstantationException:
> org.apache.tools.ant.Main
>     at java.lang.Class.newInstance0(Class.java:293)
>     at java.lang.Class.newInstance(Class.java:261)
>     at
>
org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
>     at
>
org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
> 
> I have tried both the BIN distribution and the
> source
> code distribution.  With the source code, I've used
> the included build script. 
> 
> I have also tried compiling with both Eclipse and
> JBuilder X -- both reported many compilation errors
> (though I don't know enough Java to say the errors
> were in the code and not how I organized the
> projects).  When I tried to debug within Eclipse, I
> basically got the same error message.
> 
> Any advice on how to get Ant working?
> 
> Also, it would be neat to understand how to get a
> clean build in JBX or Eclipse (just to give the
> tools
> a chance to build something more elaborate than
> "Hello, World ... have a nice day!"
> 
> Thanks
> Scott
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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