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

Related Tutorials


 
 

Share on Google+Share on Google+

How to download, compile and test the tutorials using ant.

Advertisement
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.

 

    

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 9, 2010

Related Tutorials

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

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
Sukhen Manna
April 13, 2011
J2EE

Thanks for Excelent Struat coding
DMCA.com