I need to use replaceregexp in my code but I keep getting the error that the appropriate class is not found. I've included ant-nodeps.jar inside my installer and have extracted it to the temp directory as suggested in the error msg but it still doesn't work. I've also tried unjarring ant-nodeps and including an ORO jar file.. I also need to use the propertyfile task but I am getting the same error with that as well. Am I doing something wrong?? Do I need to include something else??
thanx
jaganv
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
can you post the error in more detail, when you say you have included nodep.jar ni the installer have you used a zipgroupfileset? jars inside jars are not on the classpath
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey, Thanx for the reply. I was beginning to think that the forum was not active. I'm creating a self-extracting installer. I've included ant-nodeps.jar as part of the installer file and extract it to a temporary location b4 the installer is run. I'm using the replace regexp task and I've set the classpath for ant-nodeps.jar (to the temporary location to where I've extracted the jar file to). I've also set the ant.regexp.regexpimpl property to org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp. I keep getting the error message that the class Jdk14RegexpRegexp is not found. This class is inside ant-nodeps.jar. The installer recognizes the replaceregexp task but cant find the Jdk14RegexpRegexp matcher class. I've tried using the ORO classes (as given in the manual) instead of the Jdk14 class but it still doesn't work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I also forgot to mention that when i run my build script alone - separately as an ant task and not as part of ant installer, the task seems to work. So nothing seems to be wrong with the build script. I hope that I've posted the error message clearly enough :) .
Thanx
jaganv
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does anyone know how to solve this problem? I'm still having problems with this. Am I missing out on something basic? And is there a task which is comparable to replaceregexp that I can use instead?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is still likely to be a classpath error. Extracting the Jar and adding it to the calsspath sound likely to go wrong. Assuming you are building the installer into a selfextracting jar with ant, you should make sure that the classes inside the nodep jar are on the classpath not the nodeps jar itself.
For example if you wish to add org.apache.tools.ant.BlahTask you need to ensure when you open the installer Jar (with somethign like Winzip) there is a directory /org/apache/tools/ant containing the file BlahTask.class.
There are various ways to go about this in ant, one is to extract the nodep jar temprarily and add all the classes you need for you installer then jar them all up. Another is to use the jar task and a zipgroupfileset that specifies a fileset of jars files and puts the contents of the jars into the jar being created.
The AntInstaller task is a subclass of the Ant Jar task and so will accept a file set like the following.
Sorry, Maybe I wasn't clear enough. I am not extracting the contents of the ant-nodeps.jar file. Yes, the required class is present in the jar file. This is what I'm trying to do:
Someothertarget executes fine. When newtarget is being executed I get this error:
build.xml:33: Class not found: org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp
This class is present in the appropriate folder inside ant-nodeps.jar. Am I supposed to set the classpath for the Jdk14RegExpRegexp class as well? How do I do that?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I need to use replaceregexp in my code but I keep getting the error that the appropriate class is not found. I've included ant-nodeps.jar inside my installer and have extracted it to the temp directory as suggested in the error msg but it still doesn't work. I've also tried unjarring ant-nodeps and including an ORO jar file.. I also need to use the propertyfile task but I am getting the same error with that as well. Am I doing something wrong?? Do I need to include something else??
thanx
jaganv
can you post the error in more detail, when you say you have included nodep.jar ni the installer have you used a zipgroupfileset? jars inside jars are not on the classpath
Hey, Thanx for the reply. I was beginning to think that the forum was not active. I'm creating a self-extracting installer. I've included ant-nodeps.jar as part of the installer file and extract it to a temporary location b4 the installer is run. I'm using the replace regexp task and I've set the classpath for ant-nodeps.jar (to the temporary location to where I've extracted the jar file to). I've also set the ant.regexp.regexpimpl property to org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp. I keep getting the error message that the class Jdk14RegexpRegexp is not found. This class is inside ant-nodeps.jar. The installer recognizes the replaceregexp task but cant find the Jdk14RegexpRegexp matcher class. I've tried using the ORO classes (as given in the manual) instead of the Jdk14 class but it still doesn't work.
I also forgot to mention that when i run my build script alone - separately as an ant task and not as part of ant installer, the task seems to work. So nothing seems to be wrong with the build script. I hope that I've posted the error message clearly enough :) .
Thanx
jaganv
Does anyone know how to solve this problem? I'm still having problems with this. Am I missing out on something basic? And is there a task which is comparable to replaceregexp that I can use instead?
This is still likely to be a classpath error. Extracting the Jar and adding it to the calsspath sound likely to go wrong. Assuming you are building the installer into a selfextracting jar with ant, you should make sure that the classes inside the nodep jar are on the classpath not the nodeps jar itself.
For example if you wish to add org.apache.tools.ant.BlahTask you need to ensure when you open the installer Jar (with somethign like Winzip) there is a directory /org/apache/tools/ant containing the file BlahTask.class.
There are various ways to go about this in ant, one is to extract the nodep jar temprarily and add all the classes you need for you installer then jar them all up. Another is to use the jar task and a zipgroupfileset that specifies a fileset of jars files and puts the contents of the jars into the jar being created.
The AntInstaller task is a subclass of the Ant Jar task and so will accept a file set like the following.
<installer
file="my-installer.jar"
extractType="NonExtractor"
installConfig="antinstall-config.xml"
buildFile="build.xml"
...
>
<zipgroupfileset dir="antlib" includes="ant-nodeps.jar"/>
...
</installer>
Sorry, Maybe I wasn't clear enough. I am not extracting the contents of the ant-nodeps.jar file. Yes, the required class is present in the jar file. This is what I'm trying to do:
<path id="regexp.classpath">
<pathelement location="C:\Program Files\AntInstaller-beta0.8\antlib\ant-nodeps.jar"/>
</path>
<taskdef classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp"
classpathref="regexp.classpath" name="replaceregexp"/>
<property name="ant.regexp.regexpimpl"
value="org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp"/>
<target name="newtarget" depends="someothertarget">
<replaceregexp byline="true"
file="${installDir}\test.properties"
match="abc=(.*)"
replace="abc=finallyworking"/>
</target>
Someothertarget executes fine. When newtarget is being executed I get this error:
build.xml:33: Class not found: org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp
This class is present in the appropriate folder inside ant-nodeps.jar. Am I supposed to set the classpath for the Jdk14RegExpRegexp class as well? How do I do that?