Home Struts Struts2.1.8 How to download, compile and test the tutorials using ant.



How to download, compile and test the tutorials using ant.
Posted on: August 9, 2010 at 12:00 AM
Learn how to download, install, compile and test the tutorial examples described here.

Compiling and running Struts 2.1.8 examples with ant

     

In this section we will learn how to download and run Struts 2.1.8 examples discussed here.

You will have to install ant build tool to compile the examples. You can go to the command prompt and type the following command to check ant on your machine:

C:\Documents and Settings\Comp1>ant -version
Apache Ant version 1.7.1 compiled on June 27 2008
C:\Documents and Settings\Comp1>

The command ant -version will display the version of ant installed on your machine. If ant is not installed you will have to install ant.

You can read more about installing and using ant at http://www.roseindia.net/jboss/10_minutes_guide_to_ant.shtml

Downloading and installing the application on tomcat:

Download the code and then extract it using WinZip or any other unzipping tool. Now copy the struts2 folder into Tomcat's web apps directory.

To compile the application open command prompt and go to <Tomcat>\webapps\struts2\WEB-INF\src directory and then issue ant command as shown below:


C:\TutorialsWriting\Struts2\apache-tomcat-6.0.29\webapps\struts2\WEB-INF\src>ant

Buildfile: build.xml

clean:
[delete] Deleting directory C:\TutorialsWriting\Struts2\apache-tomcat-6.0.29\
webapps\struts2\WEB-INF\src\classes
[mkdir] Created dir: C:\TutorialsWriting\Struts2\apache-tomcat-6.0.29\webapp
s\struts2\WEB-INF\src\classes

prepare:
[copy] Copying 1 file to C:\TutorialsWriting\Struts2\apache-tomcat-6.0.29\w
ebapps\struts2\WEB-INF\src\classes

resources:
[copy] Copying 2 files to C:\TutorialsWriting\Struts2\apache-tomcat-6.0.29\
webapps\struts2\WEB-INF\src\classes

compile:
[javac] Compiling 3 source files to C:\TutorialsWriting\Struts2\apache-tomca
t-6.0.29\webapps\struts2\WEB-INF\src\classes
[jar] Building jar: C:\TutorialsWriting\Struts2\apache-tomcat-6.0.29\webap
ps\struts2\WEB-INF\lib\struts2tutorial.jar

project:

all:

BUILD SUCCESSFUL
Total time: 1 second
C:\TutorialsWriting\Struts2\apache-tomcat-6.0.29\webapps\struts2\WEB-INF\src>

The above command will compile the java files and create struts2tutorial.jar and place in the lib directory of the application.

Now run tomcat and type http://localhost:8080/struts2 to check the examples.

 

    

Related Tags for How to download, compile and test the tutorials using ant.:


More Tutorials from this section

Ask Questions?    Discuss: How to download, compile and test the tutorials using ant.  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.