participate


Java Technology & XML - trouble with ANT [Locked]
This topic is locked
<<   Back to Forum  |   Give us Feedback Topics: « Previous | Next
This topic has 34 replies on 3 pages.    « Previous | 1 | 2 | 3 | Next »
Michael-N
Posts:1
Registered: 12/28/04
Re: trouble with ANT   
Apr 3, 2005 7:19 AM (reply 15 of 34)  (In reply to #13 )

 
On Unix, the $ANT_HOME/bin/ant script may be the source of the "problem", particularly if there is a "system wide" ant installed which is different from the version of ant you want to run. Try " ant --noconfig -version ", if that works, then the culprit is the startup script:

if $no_config ; then
rpm_mode=false
usejikes=$use_jikes_default
else
# load system-wide ant configuration
if [ -f "/etc/ant.conf" ] ; then
. /etc/ant.conf # ====== I'M THE PROBLEM!!
fi

Just comment out the line in the script (always using "noconfig" prevents all other config files from being sourced, as well).

-michael
 
allelopath
Posts:201
Registered: 1/14/02
Re: trouble with ANT   
Apr 6, 2005 4:23 PM (reply 16 of 34)  (In reply to original post )

 
I have the same problem and I've tried the suggestions in this thread, but no fix.
Any other suggestions?


# ant -version
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher

# ant --noconfig -version
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher

# locate weblogic
/usr/local/eclipse/plugins/org.apache.ant_1.6.2/lib/ant-weblogic.jar
/usr/share/ant/lib/ant-weblogic.jar

# unset CLASSPATH
# /usr/share/ant/bin/ant --noconfig -version
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher

# unset PATH
# ant --noconfig -version
bash: ant: No such file or directory
# /usr/share/ant/bin/ant --noconfig -version
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher


In .bashrc, I have:

export JAVA_HOME=/usr/lib/jvm/java-1.4.2-sun
export ANT_HOME=/usr/share/ant/bin
PATH=$PATH:$HOME/bin:$JAVA_HOME:$ANT_HOME:

also tried:
PATH=$JAVA_HOME:$ANT_HOME:$PATH:$HOME/bin:
PATH=$ANT_HOME:$PATH:$HOME/bin:$JAVA_HOME:

I have only 1 version of ant installed.
 
nsasi15
Posts:16
Registered: 2/23/05
Re: trouble with ANT   
Apr 10, 2005 11:37 PM (reply 17 of 34)  (In reply to original post )

 
Remove weblogic.jar file in your classpath

java.lang.InstantiationException: org.apache.tools.ant.Main
This error wonn't come
Regards
Sasikumar
 
nsasi15
Posts:16
Registered: 2/23/05
trouble with ANT   
Apr 10, 2005 11:41 PM (reply 18 of 34)  (In reply to original post )

 
Remove weblogic.jar file in your classpath.below error could n't come

C:\ >ant -version
java.lang.InstantiationException: 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:195)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)

Sasikumar
 
xt0nguyen11
Posts:5
Registered: 2/23/04
Re: trouble with ANT   
Apr 13, 2005 12:36 PM (reply 19 of 34)  (In reply to original post )

 
check your system for an ant.conf and remove it. This maybe the root of the problem.
 
knvsharishkumar
Posts:1
Registered: 4/14/05
Re: trouble with ANT   
Apr 14, 2005 8:06 AM (reply 20 of 34)  (In reply to #11 )

 
hai dinesh who ever u may be thanks for posting the thing to add {anthome}\lib before weblogic.jar . my things are working fine after i followed ur suggestion.

thank you u are a life savior,

thank you
harish
 
krishmasingla
Posts:1
Registered: 6/30/05
Re: trouble with ANT   
Jun 30, 2005 12:30 AM (reply 21 of 34)  (In reply to #17 )

 
I have added $ANT_HOME\lib before weblogic.jar but still the error is persisting.
The ant version is 1.6.5 and weblogic is 8.1
 
Theophine
Posts:1
Registered: 10/15/05
Re: trouble with ANT   
Oct 15, 2005 6:56 PM (reply 22 of 34)  (In reply to #15 )

 
Just comment out the following lines as shown below

#if [ -f "/etc/ant.conf" ] ; then
#. /etc/ant.conf
#fi
 
nithajay
Posts:1
Registered: 10/19/05
Re: trouble with ANT   
Oct 19, 2005 1:30 PM (reply 23 of 34)  (In reply to #21 )

 
I had the same problem. I found that the problem was due to the lib directory being empty. I tried untarring the .gz again, the lib directory was empty. I copied the lib contents to my HP system from the .zip file.
 
StsBPraised
Posts:1
Registered: 5/16/06
Re: trouble with ANT   
May 16, 2006 7:32 AM (reply 24 of 34)  (In reply to #15 )

 
I had the same grief for a moment after installing.

FWIW running

ant --execdebug

I saw the classpath had "Ant/apache-ant-1.6.5/lib/ant-launcher.jar" which is incorrect--it should be "...6.5/dist/lib..." I reset the ANT_HOME environment variable to:

"...Ant/apache-ant-1.6.5/dist"

instead of "...Ant/apache-ant-1.6.5" as the docs seemed to suggest.

This took care of the

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher

problem.
 
blinks
Posts:1
Registered: 7/10/06
Re: trouble with ANT   
Jul 10, 2006 11:13 AM (reply 25 of 34)  (In reply to #15 )

 
On Unix, the $ANT_HOME/bin/ant script may be the
source of the "problem", particularly if there is a
"system wide" ant installed which is different from
the version of ant you want to run. Try " ant
--noconfig -version ", if that works, then the
culprit is the startup script:

if $no_config ; then
rpm_mode=false
usejikes=$use_jikes_default
else
# load system-wide ant configuration
if [ -f "/etc/ant.conf" ] ; then
. /etc/ant.conf # ====== I'M THE PROBLEM!!
i

Just comment out the line in the script (always using
"noconfig" prevents all other config files from being
sourced, as well).

-michael

A better solution (that won't be overwritten if you ever overwrite this file) would be to change the configuration file that's causing the difficulty.

If you have write access, just comment out (or update) the ANT_HOME in /etc/ant.conf, and that will also fix this problem.
 
Standish
Posts:1
Registered: 8/1/06
Re: trouble with ANT   
Aug 1, 2006 5:35 AM (reply 26 of 34)  (In reply to #25 )

 
One cause of the following error trying to run ANT was :

ANT_HOME was incorretly defined to be :
"C:\AntSource\apache-ant-1.6.5\bin"

Come one level up and all is well.
"C:\AntSource\apache-ant-1.6.5

ERROR Message...
Exception in thread "main" java.lang.NoClassDefFoundError: /apache/tools/ant/launch/Launcher

Message was edited by:
Standish
 
srh34
Posts:4
Registered: 5/19/06
Re: trouble with ANT   
Sep 12, 2006 5:04 AM (reply 27 of 34)  (In reply to #26 )

 
java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
at org.apache.tools.ant.taskdefs.optional.net.FTP.execute(FTP.java:1943)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:142)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:91)
at org.apache.tools.ant.Main.runBuild(Main.java:653)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)


I am also getting the same error.
set ANT_HOME=P:\apache-ant-1.6.5
set path=%path%;C:\jdk\jdk13102\bin;P:\apache-ant-1.6.5\bin;
set CLASSPATH=%CLASSPATH%;P:\apache-ant-1.6.5\lib\ant.jar;P:\apache-ant-1.6.5\lib\ant-commons-net.jar;
set JAVA_HOME=C:\jdk\JDK13102

I have set the above mentioned path but still i am getting the same error.
 
peredurabefrog
Posts:1
Registered: 1/4/07
Re: trouble with ANT   
Jan 4, 2007 4:48 AM (reply 28 of 34)  (In reply to #15 )

 
Sorry for reactivating this old question.

I'm following the Java EE 5 tutorial, with version 9 of the appserver on SuSE Linux 10.0, which is giving this same problem; and so I tried following Michael's advice. Using --noconfig with asant worked, but commenting out the line Michael mentions in the ant startup script has no effect. Building with ant didn't work at all (probably because I have version 1.6.2, but the else clause isn't supported, I understand, until 1.6.3).

Is it OK for me to use asant with -noconfig all the time? Or is there something else I should change?

Please bear in mind that I'm completely new to ant/asant, so be gentle :)

Many thanks


Peter

On Unix, the $ANT_HOME/bin/ant script may be the
source of the "problem", particularly if there is a
"system wide" ant installed which is different from
the version of ant you want to run. Try " ant
--noconfig -version ", if that works, then the
culprit is the startup script:

if $no_config ; then
rpm_mode=false
usejikes=$use_jikes_default
else
# load system-wide ant configuration
if [ -f "/etc/ant.conf" ] ; then
. /etc/ant.conf # ====== I'M THE PROBLEM!!
i

Just comment out the line in the script (always using
"noconfig" prevents all other config files from being
sourced, as well).

-michael
 
per.lanvin
Posts:1
Registered: 6/15/05
Re: trouble with ANT   
Jan 15, 2007 3:44 AM (reply 29 of 34)  (In reply to #16 )

 
Hi,

This is caused by the ANT_HOME variable being set incorrectly.

--- apache.org ---
Create an ANT_HOME environment variable to point the directory ${ant.home}, and modify the PATH environment variable to include directory "${ant.home}/bin" in its list. This makes the "ant" command line script available, which will be used to actually perform the build.
--- end ---

You need to remove '/bin' and then you'll be fine.


Rgds

/PL
 
This topic has 34 replies on 3 pages.    « Previous | 1 | 2 | 3 | Next »
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 63
  • Guests : 118

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums