  | |  | Classpath problem | Classpath problem 2004-01-10 - By Christoph Schwitter
Back I use the very same classpath for compilation and running, but when
running some class is not found.
Compilation works fine, running gets the following error
[java] java.lang.NoClassDefFoundError:
ch/elscheff/config/provider/BadConfigurationFormatExcep
ion
[java] at ch.elscheff.tools.skiptext.Start.main(Unknown Source)
[java] Exception in thread "main "
That class is included in ConfigProvider.jar
(ch\elscheff\config\provider\BadConfigurationFormatExcepion.class
I do not understand why the same classpath once works with compile and
does not work with runonly target.
Full information is below.
Thanks for help
Christoph
build.xml includes
<path id= "project.class.path " >
<pathelement path= "${java.class.path} "/ >
<fileset dir= "${lib_chsDir} " >
<include name= "**/*.jar "/ >
</fileset >
<fileset dir= "${lib_extDir} " >
<include name= "**/*.jar "/ >
</fileset >
</path >
<target name= "compile " depends= "init "
description= "Compile java source files " >
<echo >Compiling java source files in ${srcDir} to
{classDir} </echo >
<mkdir dir= "${classDir} "/ >
<javac srcdir= "${srcDir} "
destdir= "${classDir} "
includes= "**/*.java " >
<classpath refid= "project.class.path "/ >
</javac >
</target >
<target name= "runonly " depends= "init "
description= "Run the program from the jar file " >
<java jar= "${projectName}.jar "
fork= "true "
failonerror= "true " >
<classpath refid= "project.class.path "/ >
</java >
</target >
Full output:
E:\MyFiles\Projects\SkipTextFromFileList >ant runonly -v
Apache Ant version 1.6.0 compiled on December 18 2003
Buildfile: build.xml
Detected Java version: 1.4 in: D:\Java\jdk142_02\jre
Detected OS: Windows XP
parsing buildfile E:\MyFiles\Projects\SkipTextFromFileList\build.xml
with URI = file:///E:/MyFiles/
rojects/SkipTextFromFileList/build.xml
Project base dir set to: E:\MyFiles\Projects\SkipTextFromFileList
[property] Loading E:\MyFiles\Projects\global.project.properties
Build sequence for target `runonly ' is [init, runonly]
Complete build sequence is [init, runonly, zipsrc, clean, importjar,
compile, javadoc, buildjar, ex
ortjar, zipdoc, zipall, complete, runapp, ]
init:
Override ignored for property DSTAMP
Override ignored for property TSTAMP
[echo] Project: SkipTextFromFileList
[echo] Date/time: 2004-01-10 11:41:52 433
runonly:
[java] Executing 'D:\Java\jdk142_02\jre\bin\java.exe ' with arguments:
[java] '-classpath '
[java]
'D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-launcher.jar;D:\Tools\ant_1_6\apache-ant-1.6
0\lib\ant-antlr.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-apache-bsf.jar;D:\Tools\ant_1_6\apach
-ant-1.6.0\lib\ant-apache-resolver.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-commons-logging.ja
;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-commons-net.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\an
-icontract.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-jai.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\
ib\ant-jakarta-bcel.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-jakarta-log4j.jar;D:\Tools\ant_1_
\apache-ant-1.6.0\lib\ant-jakarta-oro.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-jakarta-regexp.
ar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-javamail.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant
jdepend.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-jmf.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib
ant-jsch.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-junit.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\
ib\ant-netrexx.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-nodeps.jar;D:\Tools\ant_1_6\apache-ant
1.6.0\lib\ant-starteam.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-stylebook.jar;D:\Tools\ant_1_6
apache-ant-1.6.0\lib\ant-swing.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-trax.jar;D:\Tools\ant_
_6\apache-ant-1.6.0\lib\ant-vaj.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-weblogic.jar;D:\Tools
ant_1_6\apache-ant-1.6.0\lib\ant-xalan1.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant-xalan2.jar;D:
Tools\ant_1_6\apache-ant-1.6.0\lib\ant-xslp.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\ant.jar;D:\To
ls\ant_1_6\apache-ant-1.6.0\lib\xercesImpl.jar;D:\Tools\ant_1_6\apache-ant-1.6.0\lib\xml-apis.jar;D
\Java\jdk142_02\lib\tools.jar;E:\MyFiles\Projects\SkipTextFromFileList\lib_chs\ConfigProvider.jar '
[java] '-jar '
[java]
'E:\MyFiles\Projects\SkipTextFromFileList\SkipTextFromFileList.jar '
[java]
[java] The ' characters around the executable and arguments are
[java] not part of the command.
[java] Config file:
E:\MyFiles\Projects\SkipTextFromFileList\config\config.txt
[java] java.lang.NoClassDefFoundError:
ch/elscheff/config/provider/BadConfigurationFormatExcep
ion
[java] at ch.elscheff.tools.skiptext.Start.main(Unknown Source)
[java] Exception in thread "main "
BUILD FAILED
E:\MyFiles\Projects\SkipTextFromFileList\build.xml:142: Java returned: 1
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:118)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
at org.apache.tools.ant.Task.perform(Task.java:401)
at org.apache.tools.ant.Target.execute(Target.java:338)
at org.apache.tools.ant.Target.performTasks(Target.java:365)
at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
at org.apache.tools.ant.Main.runBuild(Main.java:669)
at org.apache.tools.ant.Main.startAnt(Main.java:220)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
Total time: 1 second
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)
|
|
 |