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).
# 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
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)
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.
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.
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
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.
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.
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).
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.