Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #24548

Re: Exception in thread “main” java.lang.NoClassDefFoundError Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!feed.tweaknews.nl!217.73.144.44.MISMATCH!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail
NNTP-Posting-Date Mon, 01 Jul 2013 03:36:27 -0500
Date Mon, 01 Jul 2013 09:36:24 +0100
From lipska the kat <"nospam at neversurrender dot co dot uk">
Organization Trollbusters 3
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: Exception in thread “main” java.lang.NoClassDefFoundError Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task
References <1c9087e2-3652-4d73-8ef8-f5d3e8c4445f@googlegroups.com>
In-Reply-To <1c9087e2-3652-4d73-8ef8-f5d3e8c4445f@googlegroups.com>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
Message-ID <Rb2dndzhk7sWokzMnZ2dnUVZ8hSdnZ2d@bt.com> (permalink)
Lines 48
X-Usenet-Provider http://www.giganews.com
X-AuthenticatedUsername NoAuthUser
X-Trace sv3-h9e1MKSxkbnnQXFAxCeqALzwNVOTkjrZ0gEFEwzGus/pCuFgqJQDrPuC0UbtNyMNRAMcPMfqssd2zx8!QWa19mhDBGNxNLW8GPEom6P3rjx2lMobhRfb/rX8nJkAAEh1QVCyKImX/dnipDoOOpoYWRq+i8U=
X-Complaints-To abuse@btinternet.com
X-DMCA-Complaints-To abuse@btinternet.com
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 3317
Xref csiph.com comp.lang.java.programmer:24548

Show key headers only | View raw


On 01/07/13 08:14, morpheous.sigma@gmail.com wrote:
> I am new to Java, although I have several years experience with other langs (e.g. C/C++ etc). I am trying to run an example program, which uses Ant for its build. I have struggled to get rid of the ClassNotFoundException being thrown for the last four days and despite trying various solutions posted elsewhere on the Internet, I have been unable to solve the problem.
>
> I wonder if anyone on here can help.
>
> Here is the stack trace, (as well as my attempts to solve the problem):

Ubuntu 12.04
apache-ant-1.8.4

Firstly, the class org/apache/tools/ant/Task.class
lives in ../lib/ant.jar

You can use jar -tf <filename> to inspect a jar file.

Setting your classpath to /usr/local/apache-ant-1.9.1/lib won't include 
ant.jar, try adding ant.jar to your classpath

/usr/local/apache-ant-1.9.1/lib/ant.jar

I think you may be able to do *.jar but you'd need to test that.

I mostly use Ant in Eclipse these days where it 'just works' but I 
notice that all the jars in apache-ant-1.8.4/lib are explicitly added to 
the ant classpath in the build configuration window thingy in Eclipse.

A quick DuckDuckGo tells me that opengamma is some kind of open source 
risk analysis thing, so I presume you downloaded a jar file[s] ... is 
the jar on your classpath? If not it needs to be.

Strangely enough, the classpath causes a lot of problems to new users so
you might find this useful

http://docs.oracle.com/javase/tutorial/essential/environment/paths.html

You also need to be careful when running builds from shell scripts as a 
new shell will be created that may not have the same environment setup 
as the calling shell.

<snip>

HTH

lipska

-- 
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Exception in thread “main” java.lang.NoClassDefFoundError Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task morpheous.sigma@gmail.com - 2013-07-01 00:14 -0700
  Re: Exception in thread “main” java.lang.NoClassDefFoundError Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-07-01 09:36 +0100
  Re: Exception in thread “main” java.lang.NoClassDefFoundError Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task markspace <markspace@nospam.nospam> - 2013-07-01 09:03 -0700
    Re: Exception in thread “main” java.lang.NoClassDefFoundError Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task Lew <lewbloch@gmail.com> - 2013-07-01 17:25 -0700

csiph-web