jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes using ant to achive files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "using ant to achive files" Watch "using ant to achive files" New topic

using ant to achive files

Ronnie Livingston

Joined: Aug 07, 2001
Posts: 17
hi, im trying to use a build batch file to war a bunch of files together but i keep getting this error when i try and build it:
Exception in thread "main" java.lang.NoClassDefFoundError: C:\jdk1/3/1\lib\htmlconverter/jar;
I read on another page that the directory where the class is located is not in the classpath but i double check and it is set in my enviromental variables. I also tried adding it to my build file but i still have the same error, here is my build file:
@echo off
rem build.bat -- Build Script for the "CS4B Servlet/JSP Example" Application
set TOMCAT_HOME=C:\tomcat
set JAVA_HOME=C:\jdk1.3.1
set _CP=%CP%
rem Identify the custom class path components we need
set CP=%TOMCAT_HOME%\lib\ant.jar;%TOMCAT_HOME%\lib\servlet.jar
set CP=%CP%;%TOMCAT_HOME%\lib\jaxp.jar;%TOMCAT_HOME%\lib\parser.jar
set CP=%CP%;%JAVA_HOME%\lib\tools.jar;
rem Execute ANT to perform the requird build target
java -classpath %CP%;%CLASSPATH% org.apache.tools.ant.Main -Dtomcat.home=%TOMCAT_HOME% %1 %2 %3 %4 %5 %6 %7 %8 %9
set CP=%_CP%
set _CP=
Ronnie Livingston

Joined: Aug 07, 2001
Posts: 17
also, when setting env variables does the order matter in regards to which one i set first and so forth?
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
This question is much more suited to the Servlets and JSP forum so I am going to move it there.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Ronnie Livingston

Joined: Aug 07, 2001
Posts: 17
strange, I change the classpath so that i am using the absolute path and i got rid of other .jar files that i may not need. Now i am getting the same error but it is refering to my jaxp.jar.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17039

I don't see you defining/using ANT_HOME. This may have something to do with it. ANT_HOME points to the root of the ANT directory (NOT bin or lib).

An IDE is no substitute for an Intelligent Developer.
Ronnie Livingston

Joined: Aug 07, 2001
Posts: 17
hi Tim, so we add ANT_HOME to the classpath? I always thought that we add something to the classpath if there are java classes which can be used (ie.jar files). What is the purpose of adding ANT_HOME to the classpath?
here is my current classpath btw:
C:\tomcat\lib\servlet.jar; C:\bea\wlServer6.0\lib\weblogic.jar;C:\jdk1.3.1\lib\htmlconverter.jar;C:\tomcat\lib\ant.jar;C:\tomcat\lib\parser.jar;
[This message has been edited by Ronnie Livingston (edited August 08, 2001).]
Ronnie Livingston

Joined: Aug 07, 2001
Posts: 17
alrighty, I changed my classpath to this:
and now build works ok. Not sure why but whatever works.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: using ant to achive files
It's not a secret anymore!