ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ray Tayek <rta...@comcast.net>
Subject how to get one class file into classpath in ant?
Date Sun, 06 Nov 2005 02:10:25 GMT
hi, using the following fragment from the ant build file (see below):

	<target name="runsanscp" depends="compile" description="runusingjar">
		<java classname="Main">
			<classpath>
				<dirset dir="${bin}/src">
					<include name="Main.class" />
				</dirset>
			</classpath>
		</java>
	</target>

log file says:

runsanscp:
      [java] Running in same VM Executing 'Main' with
dirset: Setup scanner in dir 
I:\ray\workspace\areallysimpleone\bin\src with patternSet{ includes: 
[Main.class] excludes: [] }
force loading Main
Finding class Main
      [java] Could not find Main. Make sure you have it in your classpath
      [java] 	at 
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:170)

trying <fileset> fails also.

anybody got a clue?

thanks

build.xml:

<project name="areallysimpleone" default="run" basedir=".">
	<description>sample ant build file</description>
	<property environment="env" />
	<property file="${user.home}/build.properties" />
	<property file="build.properties" />
	<property name="src" location="src" />
	<property name="tst" location="tst" />
	<property name="bin" location="bin" />
	<property name="dist" location="dist" />
	<property name="ant.home" value="${env.ANT_HOME}" />
	<echo message="env.ANT_HOME=${env.ANT_HOME}" />
	<echo message="env.JAVA_HOME=${env.JAVA_HOME}" />
	<echo message="rt.jar=${env.JAVA_HOME}/jre/lib/rt.jar" />
	<property name="junit.jar" value="${ant.home}/lib/junit.jar" />
	<!-- usually one hangs out here -->
	<target name="init">
		<tstamp />
		<mkdir dir="${bin}" />
		<mkdir dir="${bin}/src" />
		<mkdir dir="${bin}/tst" />
		<mkdir dir="${dist}" />
	</target>
	<path id="lib">
		<fileset dir="lib" includes="*.jar" />
	</path>
	<target name="clean" description="clean">
		<delete dir="${bin}" />
		<delete dir="${dist}" />
	</target>
	<target name="compile" depends="init" description="compile">
		<javac srcdir="${src}" destdir="${bin}/src">
			<classpath>
				<path refid="lib" />
			</classpath>
		</javac>
	</target>
	<target name="run" depends="compile" description="run">
		<java classname="Main">
			<classpath>
				<path refid="lib" />
				<pathelement path="${bin}/src" />
			</classpath>
		</java>
	</target>
	<target name="runsanscp" depends="compile" description="runusingjar">
		<java classname="Main">
			<classpath>
				<!--fileset file="${bin}/src/Main.class"/-->
				<!--fileset dir="${bin}/src" includes="Main.class"/-->
				<!--filelist dir="${bin}/src" files="Main.class"/-->
				<dirset dir="${bin}/src">
					<include name="Main.class" />
				</dirset>
			</classpath>
		</java>
	</target>
</project>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message