You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Barry White <bw...@fotango.com> on 2005/09/20 13:50:45 UTC

Re: where is the problem?

Hi Aydin,

try putting the servlet (J2EE) classes in the classpath for the javac 
task. The following page shows you how to do this under references (it 
should look familiar):

http://ant.apache.org/manual/using.html

Barry

Aydın Toprak wrote:
> hii everybody,
> 
> I am newbie about ant I am having difficulties about ant+eclipse 
> combination...
> Now I have a working source code, I can compile it under the command 
> line .. without any problems..
> 
> how ever I couldnt been able to compile it via using ant .. .
> When I call it from eclipse, I get some intresiting errors from compiler..
> 
> that, for example, says, "\workspace\mysecond\src\form.java:2: package 
> javax.servlet does not exist
>    [javac] import javax.servlet.*;"
> 
> and continues..
> 
> this is only specific problem when I use ant to compile and deploy it..
> so I think it is related with my build.xml file.. which is...
> 
> <project name="mysecond" default="dist" basedir=".">
>    <description>
>        description tag leri arasi
>    </description>
>  <!-- set global properties for this build -->
>  <property name="src" location="src"/>
>  <property name="build" location="mybuildfolder"/>
>  <property name="dist"  location="mydistfolder"/>
> 
>  <target name="init">
>    <!-- Create the time stamp -->
>    <tstamp/>
>    <!-- Create the build directory structure used by compile -->
>    <mkdir dir="${build}"/>
>  </target>
> 
>  <target name="compile" depends="init"
>        description="compile the source " >
>    <!-- Compile the java code from ${src} into ${build} -->
>    <javac srcdir="${src}" destdir="${build}"/>
>  </target>
> 
>  <target name="dist" depends="compile"
>        description="generate the distribution" >
>    <!-- Create the distribution directory -->
>    <mkdir dir="${dist}/lib"/>
> 
>    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file 
> -->
>    <jar jarfile="${dist}/lib/mysecond -${DSTAMP}.jar" basedir="${build}"/>
>  </target>
> 
>  <target name="clean"
>        description="clean up" >
>    <!-- Delete the ${build} and ${dist} directory trees -->
>    <delete dir="${build}"/>
>    <delete dir="${dist}"/>
>  </target>
> </project>
> 
> 
> 
> I think I am misiing a little point but really getting  exhausted about 
> that...
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

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


Re: where is the problem?

Posted by Steve Loughran <st...@apache.org>.
Aydın Toprak wrote:
> Thanks for everyone;
> 
> I have solved the problem.
> The problem is all about the libraries (.jar files) that we have to add 
> the ant runtime which is in the 
> eclipse(window->preferances->ant->runtime)...
> 
> I used to add the related libraries like j2ee.jar... however whenever I 
> add those important libraries to the  runtime enviroment  and close the 
> window, every thing that I have added dissapears (as far as I 
> understood, ant envirement didnt include them!) ... but when I added 
> thoses libraries under the global entries, I have succeded... now 
> everthing stays :)...
> 
> it is a dramtic stiuation for a proffessional..
> but I am still learning.. :)
> 

You shouldnt be setting your classpath up this way. instead declare a 
path that explicitly includes a copy of j2ee.jar that you have somewhere 
in your project libraries.

<path id="j2ee.path" >
	<fileset file="lib/j2ee.jar" />
</path>

then use it in compiles

<javac ... classpathref="j2ee.path" >


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


Re: where is the problem?

Posted by Aydın Toprak <ay...@intengo.com>.
Thanks for everyone;

I have solved the problem.
The problem is all about the libraries (.jar files) that we have to add 
the ant runtime which is in the 
eclipse(window->preferances->ant->runtime)...

I used to add the related libraries like j2ee.jar... however whenever I 
add those important libraries to the  runtime enviroment  and close the 
window, every thing that I have added dissapears (as far as I 
understood, ant envirement didnt include them!) ... but when I added 
thoses libraries under the global entries, I have succeded... now 
everthing stays :)...

it is a dramtic stiuation for a proffessional..
but I am still learning.. :)



Barry White wrote:

> Ant must be using a different environment then, because it can't find 
> javax.servlet
>
> My advice would be to forget eclipse for now and get the build working 
> on the command line. How many javac's do you have on your system? 
> Which one is in your PATH? What is JAVA_HOME set to? If JAVA_HOME is 
> set to a J2SE installation there will be no javax.servlet in the 
> classpath - unless explicitly set in CLASSPATH or in the build file.
>
> Eclipse may just confuse matters while you are learning Ant. Get back 
> to basics and make sure Ant is set up correctly. I only use eclipse 
> for code editing - Ant does the rest.
>
> Good luck,
> Barry
>
> Aydın Toprak wrote:
>
>> Thanks Barry,
>> But I have already added those paths to my enviroment and everything 
>> (excep this) works smoothly.. how ever, it still resists about the 
>> missing packages.. but I have them and can compile the java code on 
>> the command promp, in the same directory..
>>
>>
>>
>> Barry White wrote:
>>
>>> Hi Aydin,
>>>
>>> try putting the servlet (J2EE) classes in the classpath for the 
>>> javac task. The following page shows you how to do this under 
>>> references (it should look familiar):
>>>
>>> http://ant.apache.org/manual/using.html
>>>
>>> Barry
>>>
>>> Aydın Toprak wrote:
>>>
>>>> hii everybody,
>>>>
>>>> I am newbie about ant I am having difficulties about ant+eclipse 
>>>> combination...
>>>> Now I have a working source code, I can compile it under the 
>>>> command line .. without any problems..
>>>>
>>>> how ever I couldnt been able to compile it via using ant .. .
>>>> When I call it from eclipse, I get some intresiting errors from 
>>>> compiler..
>>>>
>>>> that, for example, says, "\workspace\mysecond\src\form.java:2: 
>>>> package javax.servlet does not exist
>>>>    [javac] import javax.servlet.*;"
>>>>
>>>> and continues..
>>>>
>>>> this is only specific problem when I use ant to compile and deploy 
>>>> it..
>>>> so I think it is related with my build.xml file.. which is...
>>>>
>>>> <project name="mysecond" default="dist" basedir=".">
>>>>    <description>
>>>>        description tag leri arasi
>>>>    </description>
>>>>  <!-- set global properties for this build -->
>>>>  <property name="src" location="src"/>
>>>>  <property name="build" location="mybuildfolder"/>
>>>>  <property name="dist"  location="mydistfolder"/>
>>>>
>>>>  <target name="init">
>>>>    <!-- Create the time stamp -->
>>>>    <tstamp/>
>>>>    <!-- Create the build directory structure used by compile -->
>>>>    <mkdir dir="${build}"/>
>>>>  </target>
>>>>
>>>>  <target name="compile" depends="init"
>>>>        description="compile the source " >
>>>>    <!-- Compile the java code from ${src} into ${build} -->
>>>>    <javac srcdir="${src}" destdir="${build}"/>
>>>>  </target>
>>>>
>>>>  <target name="dist" depends="compile"
>>>>        description="generate the distribution" >
>>>>    <!-- Create the distribution directory -->
>>>>    <mkdir dir="${dist}/lib"/>
>>>>
>>>>    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar 
>>>> file -->
>>>>    <jar jarfile="${dist}/lib/mysecond -${DSTAMP}.jar" 
>>>> basedir="${build}"/>
>>>>  </target>
>>>>
>>>>  <target name="clean"
>>>>        description="clean up" >
>>>>    <!-- Delete the ${build} and ${dist} directory trees -->
>>>>    <delete dir="${build}"/>
>>>>    <delete dir="${dist}"/>
>>>>  </target>
>>>> </project>
>>>>
>>>>
>>>>
>>>> I think I am misiing a little point but really getting  exhausted 
>>>> about that...
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>>> For additional commands, e-mail: user-help@ant.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>


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


Re: where is the problem?

Posted by Barry White <bw...@fotango.com>.
Ant must be using a different environment then, because it can't find 
javax.servlet

My advice would be to forget eclipse for now and get the build working 
on the command line. How many javac's do you have on your system? Which 
one is in your PATH? What is JAVA_HOME set to? If JAVA_HOME is set to a 
J2SE installation there will be no javax.servlet in the classpath - 
unless explicitly set in CLASSPATH or in the build file.

Eclipse may just confuse matters while you are learning Ant. Get back to 
basics and make sure Ant is set up correctly. I only use eclipse for 
code editing - Ant does the rest.

Good luck,
Barry

Aydın Toprak wrote:
> Thanks Barry,
> But I have already added those paths to my enviroment and everything 
> (excep this) works smoothly.. how ever, it still resists about the 
> missing packages.. but I have them and can compile the java code on the 
> command promp, in the same directory..
> 
> 
> 
> Barry White wrote:
> 
>> Hi Aydin,
>>
>> try putting the servlet (J2EE) classes in the classpath for the javac 
>> task. The following page shows you how to do this under references (it 
>> should look familiar):
>>
>> http://ant.apache.org/manual/using.html
>>
>> Barry
>>
>> Aydın Toprak wrote:
>>
>>> hii everybody,
>>>
>>> I am newbie about ant I am having difficulties about ant+eclipse 
>>> combination...
>>> Now I have a working source code, I can compile it under the command 
>>> line .. without any problems..
>>>
>>> how ever I couldnt been able to compile it via using ant .. .
>>> When I call it from eclipse, I get some intresiting errors from 
>>> compiler..
>>>
>>> that, for example, says, "\workspace\mysecond\src\form.java:2: 
>>> package javax.servlet does not exist
>>>    [javac] import javax.servlet.*;"
>>>
>>> and continues..
>>>
>>> this is only specific problem when I use ant to compile and deploy it..
>>> so I think it is related with my build.xml file.. which is...
>>>
>>> <project name="mysecond" default="dist" basedir=".">
>>>    <description>
>>>        description tag leri arasi
>>>    </description>
>>>  <!-- set global properties for this build -->
>>>  <property name="src" location="src"/>
>>>  <property name="build" location="mybuildfolder"/>
>>>  <property name="dist"  location="mydistfolder"/>
>>>
>>>  <target name="init">
>>>    <!-- Create the time stamp -->
>>>    <tstamp/>
>>>    <!-- Create the build directory structure used by compile -->
>>>    <mkdir dir="${build}"/>
>>>  </target>
>>>
>>>  <target name="compile" depends="init"
>>>        description="compile the source " >
>>>    <!-- Compile the java code from ${src} into ${build} -->
>>>    <javac srcdir="${src}" destdir="${build}"/>
>>>  </target>
>>>
>>>  <target name="dist" depends="compile"
>>>        description="generate the distribution" >
>>>    <!-- Create the distribution directory -->
>>>    <mkdir dir="${dist}/lib"/>
>>>
>>>    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar 
>>> file -->
>>>    <jar jarfile="${dist}/lib/mysecond -${DSTAMP}.jar" 
>>> basedir="${build}"/>
>>>  </target>
>>>
>>>  <target name="clean"
>>>        description="clean up" >
>>>    <!-- Delete the ${build} and ${dist} directory trees -->
>>>    <delete dir="${build}"/>
>>>    <delete dir="${dist}"/>
>>>  </target>
>>> </project>
>>>
>>>
>>>
>>> I think I am misiing a little point but really getting  exhausted 
>>> about that...
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

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


Re: where is the problem?

Posted by Aydın Toprak <ay...@intengo.com>.
Thanks Barry,
But I have already added those paths to my enviroment and everything 
(excep this) works smoothly.. how ever, it still resists about the 
missing packages.. but I have them and can compile the java code on the 
command promp, in the same directory..



Barry White wrote:

> Hi Aydin,
>
> try putting the servlet (J2EE) classes in the classpath for the javac 
> task. The following page shows you how to do this under references (it 
> should look familiar):
>
> http://ant.apache.org/manual/using.html
>
> Barry
>
> Aydın Toprak wrote:
>
>> hii everybody,
>>
>> I am newbie about ant I am having difficulties about ant+eclipse 
>> combination...
>> Now I have a working source code, I can compile it under the command 
>> line .. without any problems..
>>
>> how ever I couldnt been able to compile it via using ant .. .
>> When I call it from eclipse, I get some intresiting errors from 
>> compiler..
>>
>> that, for example, says, "\workspace\mysecond\src\form.java:2: 
>> package javax.servlet does not exist
>>    [javac] import javax.servlet.*;"
>>
>> and continues..
>>
>> this is only specific problem when I use ant to compile and deploy it..
>> so I think it is related with my build.xml file.. which is...
>>
>> <project name="mysecond" default="dist" basedir=".">
>>    <description>
>>        description tag leri arasi
>>    </description>
>>  <!-- set global properties for this build -->
>>  <property name="src" location="src"/>
>>  <property name="build" location="mybuildfolder"/>
>>  <property name="dist"  location="mydistfolder"/>
>>
>>  <target name="init">
>>    <!-- Create the time stamp -->
>>    <tstamp/>
>>    <!-- Create the build directory structure used by compile -->
>>    <mkdir dir="${build}"/>
>>  </target>
>>
>>  <target name="compile" depends="init"
>>        description="compile the source " >
>>    <!-- Compile the java code from ${src} into ${build} -->
>>    <javac srcdir="${src}" destdir="${build}"/>
>>  </target>
>>
>>  <target name="dist" depends="compile"
>>        description="generate the distribution" >
>>    <!-- Create the distribution directory -->
>>    <mkdir dir="${dist}/lib"/>
>>
>>    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar 
>> file -->
>>    <jar jarfile="${dist}/lib/mysecond -${DSTAMP}.jar" 
>> basedir="${build}"/>
>>  </target>
>>
>>  <target name="clean"
>>        description="clean up" >
>>    <!-- Delete the ${build} and ${dist} directory trees -->
>>    <delete dir="${build}"/>
>>    <delete dir="${dist}"/>
>>  </target>
>> </project>
>>
>>
>>
>> I think I am misiing a little point but really getting  exhausted 
>> about that...
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>


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