Results 1 to 2 of 2
  1. #1
    Eric is offline Senior Member
    Join Date
    Jun 2007
    Posts
    111
    Rep Power
    0

    Default Problems with Eclipse and MyEclipse

    Hello, I write to ask if somebody knows the way to configurate MyEclipse with Tomcat 5, to execute Servlets and JSPs altogether, but in addition takes into a Java Project (with Classes, Beans, Exceptions).

    Eric

  2. #2
    Albert is offline Senior Member
    Join Date
    Jun 2007
    Posts
    114
    Rep Power
    0

    Default

    In the first place you must observe that the versions are compatible.

    The eclipse that I recommend to you is 3.1.2 version download it, and then configure the JRE. (C:\Program Files\Java\jdk1.5 .0_01 \ jre), it must be the same one of the tomcat (I used jakarta-tomcat-5.5.9.exe version), is configured when tomcat5 installs. Finally you must construct build.xml and do deploy…

    this is an example

    Java Code:
    <project name="out0" basedir="../" default="copywar"> 
     
        <!-- Project settings --> 
        <property name="project.distname" value="out0"/> 
     
     
        <!-- Local system paths --> 
        <property file="${basedir}/ant/build.properties"/> 
        <property name="webroot.dir" value="${basedir}/WebContent"/> 
        <property name="webinf.dir" value="${webroot.dir}/WEB-INF"/> 
        <property name="build.dir" value="build"/> 
     
        <!-- classpath for JSF 1.0 --> 
        <path id="compile.classpath"> 
            <pathelement path ="${webinf.dir}/lib/commons-beanutils.jar"/> 
            <pathelement path ="${webinf.dir}/lib/commons-collections.jar"/> 
            <pathelement path ="${webinf.dir}/lib/commons-digester.jar"/> 
            <pathelement path ="${webinf.dir}/lib/commons-logging.jar"/> 
            <pathelement path ="${webinf.dir}/lib/jsf-api.jar"/> 
            <pathelement path ="${webinf.dir}/lib/jsf-impl.jar"/> 
            <pathelement path ="${webinf.dir}/lib/jstl.jar"/> 
            <pathelement path ="${webinf.dir}/lib/standard.jar"/> 
            <pathelement path ="${webinf.dir}/classes"/> 
            <pathelement path ="${classpath.external}"/> 
            <pathelement path ="${classpath}"/> 
        </path> 
     
        <!-- define your folder for deployment --> 
        <property name="deploy.dir" value="deploy"/> 
     
     
        <!-- Local system paths --> 
        <property file="${basedir}/ant/build.properties"/> 
        <property name="webroot.dir" value="${basedir}/WebContent"/> 
        <property name="webinf.dir" value="${webroot.dir}/WEB-INF"/> 
        <property name="build.dir" value="build"/> 
     
        <!-- Check timestamp on files --> 
        <target name="prepare"> 
            <tstamp/> 
        </target> 
     
        <!-- Copy any resource or configuration files --> 
        <target name="resources"> 
            <copy todir="${webinf.dir}/classes" includeEmptyDirs="no"> 
                <fileset dir="JavaSource"> 
                <patternset> 
                    <include name="**/*.conf"/> 
                    <include name="**/*.properties"/> 
                    <include name="**/*.xml"/> 
                </patternset> 
                </fileset> 
            </copy> 
        </target> 
     
        <!-- Normal build of application --> 
        <target name="compile" depends="prepare,resources"> 
            <javac srcdir="JavaSource" destdir="${webinf.dir}/classes"> 
                <classpath refid="compile.classpath"/> 
            </javac> 
        </target> 
     
        <!-- Remove classes directory for clean build --> 
        <target name="clean" 
          description="Prepare for clean build"> 
          <delete dir="${webinf.dir}/classes"/> 
          <mkdir  dir="${webinf.dir}/classes"/> 
        </target> 
     
        <!-- Build entire project --> 
        <target name="build" depends="prepare,compile"/> 
        <target name="rebuild" depends="clean,prepare,compile"/> 
     
        <!-- Create binary distribution --> 
        <target name="war" depends="build"> 
          <mkdir dir="${build.dir}"/> 
          <war 
            basedir="${webroot.dir}" 
            warfile="${build.dir}/${project.distname}.war" 
            webxml="${webinf.dir}/web.xml"> 
            <exclude name="WEB-INF/${build.dir}/**"/> 
            <exclude name="WEB-INF/src/**"/> 
            <exclude name="WEB-INF/web.xml"/> 
           </war> 
     
        </target> 
     
        <target name="deploy" depends="war"> 
           <delete file="${deploy.dir}/${project.distname}.war"/> 
           <delete dir="${deploy.dir}/${project.distname}"/> 
           <copy file="${build.dir}/${project.distname}.war" todir="${deploy.dir}"/> 
        </target> 
             
            <target name="copywar" depends="deploy"> 
                    <copyfile dest="D:/Tomcat5/webapps/${project.distname}.war" src="${build.dir}/${project.distname}.war"/> 
             
            </target> 
    </project>
    Albert:rolleyes:

Similar Threads

  1. Problems with hibernate and eclipse
    By Albert in forum JDBC
    Replies: 2
    Last Post: 06-05-2008, 04:34 PM
  2. GUI problems.
    By saytri in forum New To Java
    Replies: 1
    Last Post: 12-16-2007, 11:27 PM
  3. Problems with Eclipse
    By Daniel in forum Eclipse
    Replies: 1
    Last Post: 07-06-2007, 05:23 PM
  4. Problems with the jar
    By Freddie in forum NetBeans
    Replies: 2
    Last Post: 05-29-2007, 04:50 PM
  5. Problems with the jar
    By Freddie in forum NetBeans
    Replies: 0
    Last Post: 05-09-2007, 03:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •