I have two classes, ZipComparison
and Tczip
. Tczip
digests a zip
file and processes its MD5
, while ZipComparison
searches for .zip
entries, and compares two different versions of the .zip
file to determine if they have the same content. For example, in a package_a
there is encodes.zip
so I want to determine if in the package_b
the encodes.zip
is the same as the .zip
file in package_a
. So I process the MD5
, and if the they match, then I don't need to copy that MD5
. The build.xml
is below:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<path id="external.classpath">
<pathelement location="src/commons-codec-1.2.jar"/>
</path>
<target name="clean">
<delete dir="build" />
</target>
<target name="compile">
<mkdir dir="build/classes" />
<javac srcdir="src/tczip" destdir="build/classes">
<classpath>
<path refid="external.classpath" />
</classpath>
</javac>
</target>
<target name="jar">
<mkdir dir="build/jar" />
<jar destfile="build/jar/Tczip.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="tczip.ZipComparison" />
</manifest>
</jar>
</target>
<target name="run">
<java jar="build/jar/Tczip.jar" fork="true" />
</target>
</project>
So I'm trying to create an ant
build file. ZipComparison
utilizes Tczip
, but when I compile, the execution is perfect, however, when I do ant run
I get the following error:
C:\Users\souzamor\workspace\tczip>ant run
Buildfile: C:\Users\souzamor\workspace\tczip\build.xml
run:
[java] Processing: bhmcommonclient.zip
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apach
e/commons/codec/binary/Hex
[java] at tczip.Tczip.digest(Unknown Source)
[java] at tczip.Tczip.execute(Unknown Source)
[java] at tczip.ZipComparison.showFiles(Unknown Source)
[java] at tczip.ZipComparison.showFiles(Unknown Source)
[java] at tczip.ZipComparison.showFiles(Unknown Source)
[java] at tczip.ZipComparison.showFiles(Unknown Source)
[java] at tczip.ZipComparison.showFiles(Unknown Source)
[java] at tczip.ZipComparison.matchMD5(Unknown Source)
[java] at tczip.ZipComparison.main(Unknown Source)
[java] Caused by: java.lang.ClassNotFoundException: org.apache.commons.code
c.binary.Hex
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
[java] ... 9 more
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 4 seconds
I know Tczip
is missing on the compile
stage, but how can I add that along ZipComparison
so I don't have that kind of error ?
Thanks