Building a Struts web app fails [message #56435] |
Sat, 23 April 2005 00:03 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: mikey_y.yahoo.com
When I try to build my struts project in Eclipse I get the following
error in the console.
Buildfile: F:\eclipse\eclipse\workspace\strutsTutorial\build.xml
clean:
[delete] Deleting directory
F:\eclipse\eclipse\workspace\strutsTutorial\WEB-INF\classes
prep:
[mkdir] Created dir:
F:\eclipse\eclipse\workspace\strutsTutorial\WEB-INF\classes
cleanWebApp:
compile:
[javac] Compiling 1 source file to
F:\eclipse\eclipse\workspace\strutsTutorial\WEB-INF\classes
BUILD FAILED: F:\eclipse\eclipse\workspace\strutsTutorial\build.xml:40:
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
Total time: 2 seconds
After which the build process stops.
My build.xml file contains the following
<project name="StrutsBox Blank Project" default="main" basedir=".">
<!-- This is a basic build script, only the minimums here -->
<!-- Tell ant to use my environment variables -->
<property environment="env"/>
<property file="./build.properties"/>
<property name="build.compiler" value="modern"/>
<property name="build.dir" value="./WEB-INF/classes" />
<property name="src.dir" value="./WEB-INF/src"/>
<property name="war.file" value="struts-example"/>
<property name="war.file.name" value="${war.file}.war"/>
<property name="tomcat.home" value="${env.CATALINA_HOME}"/>
<property name="deploy.dir" value="${tomcat.home}/webapps"/>
<property name="servlet.jar"
value="${tomcat.home}/common/lib/servlet-api.jar"/>
<path id="project.class.path">
<fileset dir="./WEB-INF/lib/">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${src.dir}"/>
<pathelement path="${servlet.jar}"/>
</path>
<target name="clean">
<delete dir="${build.dir}" includeEmptyDirs="true" />
</target>
<target name="prep">
<mkdir dir="${build.dir}"/>
</target>
<target name="compile">
<javac srcdir="${src.dir}"
destdir="${build.dir}"
debug="on"
deprecation="on">
<include name="**/*.java"/>
<classpath refid="project.class.path"/>
</javac>
</target>
<target name="cleanWebApp">
<delete file="${deploy.dir}/${war.file.name}" />
<delete dir="${deploy.dir}/${war.file}"
includeEmptyDirs="true" />
</target>
<target name="war">
<war warfile="${war.file.name}" webxml="./WEB-INF/web.xml">
<fileset dir="./" includes="**/*.*" excludes="*.war,
**/*.nbattrs, web.xml, **/WEB-INF/**/*.*, **/project-files/**/*.*"/>
<webinf dir="./WEB-INF" includes="**/*"
excludes="web.xml, **/*.jar, **/*.class"/>
<lib dir="./WEB-INF/lib"/>
<classes dir="${build.dir}" includes="**/*.properties" />
</war>
</target>
<target name="deploy">
<copy todir="${deploy.dir}">
<fileset dir="./" includes="${war.file.name}"/>
</copy>
</target>
<target name="main" depends="clean, prep, cleanWebApp, compile, war"/>
</project>
It appears to me that I need to specify in the build file where to find
the javac executable. I have a classpath set in my system environment
variables but this does not seem to be found by the build process.
Can anyone help me with this problem?
|
|
|
Re: Building a Struts web app fails [message #56490 is a reply to message #56435] |
Sat, 23 April 2005 01:23 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: mikey_y.yahoo.com
mikey_y wrote:
> When I try to build my struts project in Eclipse I get the following
> error in the console.
>
>
> Buildfile: F:\eclipse\eclipse\workspace\strutsTutorial\build.xml
> clean:
> [delete] Deleting directory
> F:\eclipse\eclipse\workspace\strutsTutorial\WEB-INF\classes
> prep:
> [mkdir] Created dir:
> F:\eclipse\eclipse\workspace\strutsTutorial\WEB-INF\classes
> cleanWebApp:
> compile:
> [javac] Compiling 1 source file to
> F:\eclipse\eclipse\workspace\strutsTutorial\WEB-INF\classes
> BUILD FAILED: F:\eclipse\eclipse\workspace\strutsTutorial\build.xml:40:
> Unable to find a javac compiler;
> com.sun.tools.javac.Main is not on the classpath.
> Perhaps JAVA_HOME does not point to the JDK
> Total time: 2 seconds
>
> After which the build process stops.
>
> My build.xml file contains the following
>
> <project name="StrutsBox Blank Project" default="main" basedir=".">
>
> <!-- This is a basic build script, only the minimums here -->
>
> <!-- Tell ant to use my environment variables -->
> <property environment="env"/>
>
> <property file="./build.properties"/>
>
> <property name="build.compiler" value="modern"/>
> <property name="build.dir" value="./WEB-INF/classes" />
> <property name="src.dir" value="./WEB-INF/src"/>
> <property name="war.file" value="struts-example"/>
> <property name="war.file.name" value="${war.file}.war"/>
> <property name="tomcat.home" value="${env.CATALINA_HOME}"/>
> <property name="deploy.dir" value="${tomcat.home}/webapps"/>
> <property name="servlet.jar"
> value="${tomcat.home}/common/lib/servlet-api.jar"/>
>
> <path id="project.class.path">
> <fileset dir="./WEB-INF/lib/">
> <include name="**/*.jar"/>
> </fileset>
> <pathelement path="${src.dir}"/>
> <pathelement path="${servlet.jar}"/>
> </path>
>
> <target name="clean">
> <delete dir="${build.dir}" includeEmptyDirs="true" />
> </target>
>
>
> <target name="prep">
> <mkdir dir="${build.dir}"/>
> </target>
>
> <target name="compile">
> <javac srcdir="${src.dir}"
> destdir="${build.dir}"
> debug="on"
> deprecation="on">
> <include name="**/*.java"/>
> <classpath refid="project.class.path"/>
> </javac>
> </target>
>
> <target name="cleanWebApp">
> <delete file="${deploy.dir}/${war.file.name}" />
> <delete dir="${deploy.dir}/${war.file}"
> includeEmptyDirs="true" />
> </target>
>
> <target name="war">
> <war warfile="${war.file.name}" webxml="./WEB-INF/web.xml">
> <fileset dir="./" includes="**/*.*" excludes="*.war,
> **/*.nbattrs, web.xml, **/WEB-INF/**/*.*, **/project-files/**/*.*"/>
> <webinf dir="./WEB-INF" includes="**/*"
> excludes="web.xml, **/*.jar, **/*.class"/>
> <lib dir="./WEB-INF/lib"/>
> <classes dir="${build.dir}" includes="**/*.properties" />
> </war>
> </target>
>
> <target name="deploy">
> <copy todir="${deploy.dir}">
> <fileset dir="./" includes="${war.file.name}"/>
> </copy>
> </target>
>
> <target name="main" depends="clean, prep, cleanWebApp, compile, war"/>
>
> </project>
> It appears to me that I need to specify in the build file where to find
> the javac executable. I have a classpath set in my system environment
> variables but this does not seem to be found by the build process.
>
> Can anyone help me with this problem?
I had a look in another newsgroup and found the answer to this question.
Just in case anyone reading this needs to know, this is what I did. For
my situation, I needed to add the tools.jar to my ANT preferences
classpath. I used the Add External JARs option to add the it to my ANT
Home Entries, the tools.jar is in the java jdk lib directory.
I am using Eclipse version 3.01, and I believe these instructions are
version specific.
The information came from this site http://eclipsewiki.editme.com/ANTFaq
Cheers
|
|
|
Powered by
FUDForum. Page generated in 0.07859 seconds