?
Solved

ant NoClassDefFoundError

Posted on 2005-04-24
17
Medium Priority
?
2,072 Views
Last Modified: 2012-05-05
I'm trying to use ant to run a java app on a linux system.

According to "ant -v" I'm using:
  Apache Ant version 1.5.2-26 compiled on May  5 2004

Here's the weird part. If I run ant it says "java.lang.NoClassDefFoundError: com.knowlist.list.stats.affinity.CalcAffinities". But, if I remove the jar file containing that class from the lib directory then it says the following when I run ant "Could not find com.knowlist.list.stats.affinity.CalcAffinities. Make sure you have it in your classpath". Notice that it doesn't say "Make sure you have it in your classpath" in the first run.

That implies to me that in the first case it's actually finding the jar, but for some reason it still gives a NoClassDefFoundError. I've got lots of other jar files in the lib directory, so it's not like the latter message only occurs if no jars are in the classpath.

Here's the sequence of commands I did:

[knowlist:jetty:~/cron]$ ant
Buildfile: build.xml

calcAffinities:
     [java] java.lang.NoClassDefFoundError: com.knowlist.list.stats.affinity.CalcAffinities

BUILD SUCCESSFUL
Total time: 0 seconds
[knowlist:jetty:~/cron]$ mv lib/know.jar ..
[knowlist:jetty:~/cron]$ ant
Buildfile: build.xml

calcAffinities:
     [java] Could not find com.knowlist.list.stats.affinity.CalcAffinities. Make sure you have it in your classpath

BUILD SUCCESSFUL
Total time: 0 seconds



Here's the build.xml file.
<?xml version="1.0"?>
<project default="calcAffinities">
        <path id="cronClassPath">
                <pathelement location="./lib"/>
                <fileset dir="/home/jetty/cron/lib">
                        <include name="*.jar"/>
                </fileset>
        </path>

        <target name="calcAffinities">
                <java classname="com.knowlist.list.stats.affinity.CalcAffinities" classpathref="cronClassPath"/>
        </target>
</project>


The only possibility I see is that the class itself is throwing a NoClassDefFoundError, but if that was the case then it should indicate which class it can't find.
0
Comment
Question by:HappyEngineer
  • 9
  • 6
  • 2
17 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 13855507
Can you post the output of

jar -tf know.jar | grep CalcAffinities

?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13855525
If you run Ant in debug mode, you'll get more info about what's happening :

ant -debug >ant-debug.log 2>&1
0
 

Author Comment

by:HappyEngineer
ID: 13855526
$ jar -tf know.jar | grep CalcAffinities
com/knowlist/list/stats/affinity/CalcAffinities$CompareByAffinityNumerator.class
com/knowlist/list/stats/affinity/CalcAffinities$IntVal.class
com/knowlist/list/stats/affinity/CalcAffinities$ObjWithAffinity.class
com/knowlist/list/stats/affinity/CalcAffinities.class

That was executed while in "/home/jetty/cron/lib".
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 86

Expert Comment

by:CEHJ
ID: 13855544
Try running in debug mode as i showed above
0
 

Author Comment

by:HappyEngineer
ID: 13855555
It looks like it can't find the optional tasks, but that shouldn't be a problem here.

The only thing I see is that it says it detected java version 1.4 in /usr. That's strange because the java version in that location (and anywhere on the machine AFAIK) is jdk 1.5.

If it was being executed with 1.4 then it should be giving an error indicating the major minor version number 49.0 (or something like that) is unknown. It wouldn't just complain that the class def wasn't found.

ANT_HOME wasn't set, but when I tried setting it to point it at /usr/share/ant it didn't make any difference.


$ ant -debug >ant-debug.log 2>&1
$ vi ant-debug.log

Apache Ant version 1.5.2-26 compiled on May  5 2004
Buildfile: build.xml
Detected Java version: 1.4 in: /usr
Detected OS: Linux
Could not load class (org.apache.tools.ant.taskdefs.optional.javacc.JJTree) for task jjtree
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Revert) for task p4revert
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSCHECKIN) for task vsscheckin
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Label) for task p4label
 +User task: sql     org.apache.tools.ant.taskdefs.SQLExec
 +User task: cvspass     org.apache.tools.ant.taskdefs.CVSPass
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.CSharp) for task csc
 +User task: dirname     org.apache.tools.ant.taskdefs.Dirname
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.WLRun) for task wlrun
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Reopen) for task p4reopen
Could not load class (org.apache.tools.ant.taskdefs.optional.ReplaceRegExp) for task replaceregexp
Could not load class (org.apache.tools.ant.taskdefs.optional.PropertyFile) for task propertyfile
Could not load class (org.apache.tools.ant.taskdefs.Get) for task get
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.DDCreator) for task ddcreator
 +User task: sleep     org.apache.tools.ant.taskdefs.Sleep
 +User task: patch     org.apache.tools.ant.taskdefs.Patch
 +User task: zip     org.apache.tools.ant.taskdefs.Zip
Could not load class (org.apache.tools.ant.taskdefs.optional.jsp.JspC) for task jspc
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSGET) for task vssget
 +User task: style     org.apache.tools.ant.taskdefs.XSLTProcess
Could not load class (org.apache.tools.ant.taskdefs.optional.Test) for task test
 +User task: unwar     org.apache.tools.ant.taskdefs.Expand
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSHISTORY) for task vsshistory
Could not load class (org.apache.tools.ant.taskdefs.optional.depend.Depend) for task depend
Could not load class (org.apache.tools.ant.taskdefs.optional.sitraka.Coverage) for task jpcoverage
Could not load class (org.apache.tools.ant.taskdefs.optional.ccm.CCMCheckin) for task ccmcheckin
 +User task: bzip2     org.apache.tools.ant.taskdefs.BZip2
 +User task: genkey     org.apache.tools.ant.taskdefs.GenerateKey
Could not load class (org.apache.tools.ant.taskdefs.optional.metamata.MParse) for task mparse
Could not load class (org.apache.tools.ant.taskdefs.optional.i18n.Translate) for task translate
 +User task: signjar     org.apache.tools.ant.taskdefs.SignJar
Could not load class (org.apache.tools.ant.taskdefs.optional.ide.VAJLoadProjects) for task vajload
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.JarLibManifestTask) for task jarlib-manifest
Could not load class (org.apache.tools.ant.taskdefs.optional.javacc.JavaCC) for task javacc
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.JarLibResolveTask) for task jarlib-resolve
Could not load class (org.apache.tools.ant.taskdefs.optional.sos.SOSCheckout) for task soscheckout
 +User task: war     org.apache.tools.ant.taskdefs.War
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.WLStop) for task wlstop
 +User task: move     org.apache.tools.ant.taskdefs.Move
 +User task: copydir     org.apache.tools.ant.taskdefs.Copydir
 +User task: javadoc2     org.apache.tools.ant.taskdefs.Javadoc
 +User task: basename     org.apache.tools.ant.taskdefs.Basename
 +User task: taskdef     org.apache.tools.ant.taskdefs.Taskdef
 +User task: tempfile     org.apache.tools.ant.taskdefs.TempFile
 +User task: condition     org.apache.tools.ant.taskdefs.ConditionTask
 +User task: pathconvert     org.apache.tools.ant.taskdefs.PathConvert
 +User task: exec     org.apache.tools.ant.taskdefs.ExecTask
 +User task: manifest     org.apache.tools.ant.taskdefs.ManifestTask
Could not load class (org.apache.tools.ant.taskdefs.optional.net.FTP) for task ftp
Could not load class (org.apache.tools.ant.taskdefs.optional.NetRexxC) for task netrexxc
Could not load class (org.apache.tools.ant.taskdefs.optional.ANTLR) for task antlr
Could not load class (org.apache.tools.ant.taskdefs.optional.sitraka.CovReport) for task jpcovreport
 +User task: copyfile     org.apache.tools.ant.taskdefs.Copyfile
 +User task: ant     org.apache.tools.ant.taskdefs.Ant
 +User task: xslt     org.apache.tools.ant.taskdefs.XSLTProcess
Could not load class (org.apache.tools.ant.taskdefs.optional.XMLValidateTask) for task xmlvalidate
Could not load class (org.apache.tools.ant.taskdefs.optional.Native2Ascii) for task native2ascii
 +User task: gzip     org.apache.tools.ant.taskdefs.GZip
Could not load class (org.apache.tools.ant.taskdefs.optional.ccm.CCMCheckinDefault) for task ccmcheckintask
Could not load class (org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut) for task starteam
 +User task: ear     org.apache.tools.ant.taskdefs.Ear
Could not load class (org.apache.tools.ant.taskdefs.optional.starteam.StarTeamCheckin) for task stcheckin
 +User task: input     org.apache.tools.ant.taskdefs.Input
 +User task: available     org.apache.tools.ant.taskdefs.Available
Could not load class (org.apache.tools.ant.taskdefs.optional.EchoProperties) for task echoproperties
 +User task: loadproperties     org.apache.tools.ant.taskdefs.LoadProperties
 +User task: checksum     org.apache.tools.ant.taskdefs.Checksum
 +User task: rmic     org.apache.tools.ant.taskdefs.Rmic
 +User task: mail     org.apache.tools.ant.taskdefs.email.EmailTask
 +User task: loadfile     org.apache.tools.ant.taskdefs.LoadFile
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSCHECKOUT) for task vsscheckout
Could not load class (org.apache.tools.ant.taskdefs.optional.StyleBook) for task stylebook
 +User task: delete     org.apache.tools.ant.taskdefs.Delete
Could not load class (org.apache.tools.ant.taskdefs.optional.ccm.CCMCreateTask) for task ccmcreatetask
Could not load class (org.apache.tools.ant.taskdefs.optional.Script) for task script
 +User task: antstructure     org.apache.tools.ant.taskdefs.AntStructure
Could not load class (org.apache.tools.ant.taskdefs.optional.Cab) for task cab
 +User task: touch     org.apache.tools.ant.taskdefs.Touch
 +User task: parallel     org.apache.tools.ant.taskdefs.Parallel
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCCheckout) for task cccheckout
Could not load class (org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask) for task jdepend
 +User task: filter     org.apache.tools.ant.taskdefs.Filter
 +User task: xmlproperty     org.apache.tools.ant.taskdefs.XmlProperty
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Have) for task p4have
 +User task: copy     org.apache.tools.ant.taskdefs.Copy
 +User task: typedef     org.apache.tools.ant.taskdefs.Typedef
 +User task: antcall     org.apache.tools.ant.taskdefs.CallTarget
Could not load class (org.apache.tools.ant.taskdefs.optional.splash.SplashTask) for task splash
 +User task: concat     org.apache.tools.ant.taskdefs.Concat
Could not load class (org.apache.tools.ant.taskdefs.optional.starteam.StarTeamLabel) for task stlabel
Could not load class (org.apache.tools.ant.taskdefs.optional.Rpm) for task rpm
 +User task: gunzip     org.apache.tools.ant.taskdefs.GUnzip
Could not load class (org.apache.tools.ant.taskdefs.optional.sos.SOSCheckin) for task soscheckin
Could not load class (org.apache.tools.ant.taskdefs.optional.net.MimeMail) for task mimemail
Could not load class (org.apache.tools.ant.taskdefs.optional.metamata.MMetrics) for task mmetrics
 +User task: replace     org.apache.tools.ant.taskdefs.Replace
 +User task: waitfor     org.apache.tools.ant.taskdefs.WaitFor
 +User task: untar     org.apache.tools.ant.taskdefs.Untar
Could not load class (org.apache.tools.ant.taskdefs.optional.junit.JUnitTask) for task junit
Could not load class (org.apache.tools.ant.taskdefs.optional.ide.VAJExport) for task vajexport
Could not load class (org.apache.tools.ant.taskdefs.optional.starteam.StarTeamCheckout) for task stcheckout
 +User task: bunzip2     org.apache.tools.ant.taskdefs.BUnzip2
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.IPlanetEjbcTask) for task iplanet-ejbc
Could not load class (org.apache.tools.ant.taskdefs.optional.ccm.CCMCheckout) for task ccmcheckout
 +User task: execon     org.apache.tools.ant.taskdefs.ExecuteOn
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSCREATE) for task vsscreate
Could not load class (org.apache.tools.ant.taskdefs.optional.metamata.MAudit) for task maudit
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Edit) for task p4edit
 +User task: unjar     org.apache.tools.ant.taskdefs.Expand
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.Ejbc) for task ejbc
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Sync) for task p4sync
 +User task: record     org.apache.tools.ant.taskdefs.Recorder
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet) for task wsdltodotnet
 +User task: mkdir     org.apache.tools.ant.taskdefs.Mkdir
 +User task: cvs     org.apache.tools.ant.taskdefs.Cvs
Could not load class (org.apache.tools.ant.taskdefs.optional.sos.SOSGet) for task sosget
Could not load class (org.apache.tools.ant.taskdefs.optional.net.TelnetTask) for task telnet
 +User task: fixcrlf     org.apache.tools.ant.taskdefs.FixCRLF
Could not load class (org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator) for task junitreport
Could not load class (org.apache.tools.ant.taskdefs.optional.jsp.WLJspc) for task wljspc
 +User task: echo     org.apache.tools.ant.taskdefs.Echo
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCUpdate) for task ccupdate
 +User task: java     org.apache.tools.ant.taskdefs.Java
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCCheckin) for task cccheckin
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSLABEL) for task vsslabel
Could not load class (org.apache.tools.ant.taskdefs.optional.RenameExtensions) for task renameext
 +User task: tar     org.apache.tools.ant.taskdefs.Tar
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSCP) for task vsscp
Could not load class (org.apache.tools.ant.taskdefs.optional.ide.VAJImport) for task vajimport
 +User task: property     org.apache.tools.ant.taskdefs.Property
Could not load class (org.apache.tools.ant.taskdefs.optional.net.SetProxy) for task setproxy
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Counter) for task p4counter
 +User task: sequential     org.apache.tools.ant.taskdefs.Sequential
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.Ilasm) for task ilasm
Could not load class (org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy) for task serverdeploy
 +User task: rename     org.apache.tools.ant.taskdefs.Rename
Could not load class (org.apache.tools.ant.taskdefs.optional.starteam.StarTeamList) for task stlist
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.EjbJar) for task ejbjar
 +User task: apply     org.apache.tools.ant.taskdefs.Transform
Could not load class (org.apache.tools.ant.taskdefs.optional.sitraka.CovMerge) for task jpcovmerge
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCUnCheckout) for task ccuncheckout
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet) for task WsdlToDotnet
 +User task: buildnumber     org.apache.tools.ant.taskdefs.BuildNumber
 +User task: cvstagdiff     org.apache.tools.ant.taskdefs.cvslib.CvsTagDiff
Could not load class (org.apache.tools.ant.taskdefs.optional.jlink.JlinkTask) for task jlink
Could not load class (org.apache.tools.ant.taskdefs.optional.pvcs.Pvcs) for task pvcs
 +User task: chmod     org.apache.tools.ant.taskdefs.Chmod
 +User task: jar     org.apache.tools.ant.taskdefs.Jar
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.JarLibAvailableTask) for task jarlib-available
Could not load class (org.apache.tools.ant.taskdefs.optional.sound.SoundTask) for task sound
 +User task: javadoc     org.apache.tools.ant.taskdefs.Javadoc
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient) for task blgenclient
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSADD) for task vssadd
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Delete) for task p4delete
 +User task: uptodate     org.apache.tools.ant.taskdefs.UpToDate
Could not load class (org.apache.tools.ant.taskdefs.optional.Javah) for task javah
Could not load class (org.apache.tools.ant.taskdefs.optional.ccm.CCMReconfigure) for task ccmreconfigure
 +User task: fail     org.apache.tools.ant.taskdefs.Exit
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Change) for task p4change
 +User task: unzip     org.apache.tools.ant.taskdefs.Expand
 +User task: javac     org.apache.tools.ant.taskdefs.Javac
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Submit) for task p4submit
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Add) for task p4add
 +User task: cvschangelog     org.apache.tools.ant.taskdefs.cvslib.ChangeLogTask
Could not load class (org.apache.tools.ant.taskdefs.optional.sos.SOSLabel) for task soslabel
Could not load class (org.apache.tools.ant.taskdefs.optional.IContract) for task icontract
 +User task: tstamp     org.apache.tools.ant.taskdefs.Tstamp
 +User task: dependset     org.apache.tools.ant.taskdefs.DependSet
 +User task: deltree     org.apache.tools.ant.taskdefs.Deltree
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.JarLibDisplayTask) for task jarlib-display
 +User datatype: dirset     org.apache.tools.ant.types.DirSet
 +User datatype: fileset     org.apache.tools.ant.types.FileSet
 +User datatype: filterreader     org.apache.tools.ant.types.AntFilterReader
 +User datatype: filterset     org.apache.tools.ant.types.FilterSet
 +User datatype: patternset     org.apache.tools.ant.types.PatternSet
 +User datatype: regexp     org.apache.tools.ant.types.RegularExpression
 +User datatype: path     org.apache.tools.ant.types.Path
 +User datatype: selector     org.apache.tools.ant.types.selectors.SelectSelector
 +User datatype: mapper     org.apache.tools.ant.types.Mapper
 +User datatype: xmlcatalog     org.apache.tools.ant.types.XMLCatalog
 +User datatype: description     org.apache.tools.ant.types.Description
 +User datatype: substitution     org.apache.tools.ant.types.Substitution
 +User datatype: filterchain     org.apache.tools.ant.types.FilterChain
 +User datatype: filelist     org.apache.tools.ant.types.FileList
Setting ro project property: ant.version -> Apache Ant version 1.5.2-26 compiled on May  5 2004
Setting ro project property: ant.file -> /home/jetty/cron/build.xml
parsing buildfile build.xml with URI = file:/home/jetty/cron/build.xml
Project base dir set to: /home/jetty/cron
   +DataType: path
Adding reference: cronClassPath ->
 +Target: calcAffinities
   +Task: java
Build sequence for target `calcAffinities' is [calcAffinities]
Complete build sequence is [calcAffinities]

calcAffinities:
     [java] Running in same VM Executing 'com.knowlist.list.stats.affinity.CalcAffinities' with
fileset: Setup scanner in dir /home/jetty/cron/lib with patternSet{ includes: [*.jar] excludes: [] }
force loading com.knowlist.list.stats.affinity.CalcAffinities
Finding class com.knowlist.list.stats.affinity.CalcAffinities
Class java.lang.Object loaded from parent loader
Class java.sql.Connection loaded from parent loader
Class java.lang.String loaded from parent loader
     [java] java.lang.NoClassDefFoundError: com.knowlist.list.stats.affinity.CalcAffinities

BUILD SUCCESSFUL
Total time: 0 seconds
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13855573
It's conceivable that CalcAffinities has an entry in the jar but is not defined properly. e.g. it's possible to reproduce this kind of error by deleting the code from the source file. As another kind of check, try running it directly:

java -cp /home/jetty/cron/lib/know.jar com.knowlist.list.stats.affinity.CalcAffinities
0
 

Author Comment

by:HappyEngineer
ID: 13855582
The following works:
  java -cp /home/jetty/cron/lib/know.jar:/home/jetty/cron/lib/commons-collections-2.1.1.jar:/home/jetty/cron/lib/log4j-1.2.9.jar:/home/jetty/cron/lib/postgresql-8.0-310.jdbc3.jar:/home/jetty/cron/lib/c3p0-0.9.0-pre5-G42.jar com.knowlist.list.stats.affinity.CalcAffinities
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13855604
Bang goes my last theory then ;-)

Can you try this:


<target name="calcAffinities">
      <java classname="com.knowlist.list.stats.affinity.CalcAffinities">
            <classpath refid="cronClassPath" />
      </java>
</target>


?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13855610
Hang on - i think the path element should be *inside* the calcAffinities target!
0
 

Author Comment

by:HappyEngineer
ID: 13855640
Right now, it is:
  <java classname="com.knowlist.list.stats.affinity.CalcAffinities" classpathref="cronClassPath"/>
if I run ant with that then it outputs
  [java] java.lang.NoClassDefFoundError: com.knowlist.list.stats.affinity.CalcAffinities

If I change it to be:
  <java classname="com.knowlist.list.stats.affinity.CalcAffinities"/>
then it otutputs
  [java] Could not find com.knowlist.list.stats.affinity.CalcAffinities. Make sure you have it in your classpath

So, without the classpathref it outputs the same message as when I removed the know.jar from the lib dir.

I've tried putting the path directly inside the java element, but it acts just like it does when using it via classpathref.

Does ant 1.5 work with jdk 1.5? I can't imagine why it wouldn't. Why would it say it found java 1.4 in the debug output?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13855658
>>I've tried putting the path directly inside the java element

I meant inside the target element - is that what you did?

>>Does ant 1.5 work with jdk 1.5?

Not sure

>>Why would it say it found java 1.4 in the debug output?

Again not sure, but i'd take a guess that these last two are not relevant

0
 

Author Comment

by:HappyEngineer
ID: 13855674
I hadn't tried it in the target, but I just tried it now and no luck:

ANT FILE:
<?xml version="1.0"?>
<project default="calcAffinities">
        <target name="calcAffinities">
            <path id="cronClassPath">
                <pathelement location="./lib"/>
                <fileset dir="/home/jetty/cron/lib">
                        <include name="*.jar"/>
                </fileset>
            </path>
            <java classname="com.knowlist.list.stats.affinity.CalcAffinities" classpathref="cronClassPath"/>
        </target>
</project>


EXECUTION:
$ ant
Buildfile: build.xml

calcAffinities:
     [java] java.lang.NoClassDefFoundError: com.knowlist.list.stats.affinity.CalcAffinities

BUILD SUCCESSFUL
Total time: 0 seconds

0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 600 total points
ID: 13855758
This has got me stumped, but i've got to go now - it's later here ;-)

It may be worthwhile updating Ant anyway. I get this classpath-oriented output in 1.6.2:

     [java] Executing 'C:\PROGRA~1\Java\JRE15~1.0_0\bin\java.exe' with arguments:
     [java] '-classpath'
     [java] 'C:\Documents and Settings\Charles\workspace;C:\Documents and Settings\Charles\workspace\cards.jar'
     [java] 'eedemo.code.Cards'
     [java]

and i see you're not getting that
0
 
LVL 15

Accepted Solution

by:
aozarov earned 1400 total points
ID: 13856297
Try using fork="true"
e.g. <java classname="com.knowlist.list.stats.affinity.CalcAffinities" classpathref="cronClassPath" fork="true"/>
0
 

Author Comment

by:HappyEngineer
ID: 13856348
Aha! That did it. After doing fork="true" it output helpful error messages. It actually was a problem with 1.4.

The thing is, it was using something called "gij" instead of the jdk 1.5 that I had installed.

So, I renamed "gij" and "gij34" to "gij.bak" and "gij34.bak".

Then, I created sumbolic links from gij and gij34 to /usr/java/jdk/bin/java.

Then, I ran ant again and now it works great! Thanks!
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13856360
Np.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13857623
:-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question