Resolve noclassdeffounderror in ant

Resolve noclassdeffounderror in ant

This is documented in ant’s user manual.

Ant classpath is made out of jars that are added in a specific sequence.

  • First Ant would add jars that are passed as part of -lib argument.For -lib a directory path (could be relative from build script) of classpath jars as well as lisr of individual jars can be a valid argument.
    ant -lib /app/lib/axis2 -lib /app/lib/log4j
    ant -lib lib/axis2 -lib lib/log4j (when executing from /app as example)
    ant -lib lib/axis2/axis2.jar -lib lib/log4j/log4j.jar
    ant -lib lib/axis2/axis2.jar:lib/log4j/log4j.jar
    
  • Ant would then add jars from user home .ant directory. It is usually referred as ${user.home}/.ant/libThis is a preferred location for development only as your .ant directory will not be shared when running continuous integration server.
  • Ant would then add jars from ANT_HOME/lib.I would suggest not to use this option at all. Changing Ant installation could lead to class conflicts when your builds are looking for different versions of the same jar.

Aly Chiman

Aly Chiman is a Blogger & Reporter at AlyChiTech.com which covers a wide variety of topics from local news from digital world fashion and beauty . AlyChiTech covers the top notch content from the around the world covering a wide variety of topics. Aly is currently studying BS Mass Communication at University.