Installation and set up
Eclipse,Tomcat,ANT, Spring Framework Guide
Author: Anup Niroula
1. Installing and configuring Eclipse IDE for Web Development
To download eclipse in ubuntu: sudo apt-get install eclipse
In Linux, we need to install WTP plugins for JEE to create web applications.
# how to install Web Tools Platform(WTP) plugins in eclise ..?
1. Run the Eclipse IDE
2. Go to Help Menu-->Install new software
3. Give this url on 'work with' http://download.eclipse.org/releases/galileo/ and click 'Add' to download Java EE plugins from the repository
Note: There are two projects of eclipse: Galileo and helios. The one we are using is Galileo.
So, do not install plugins from the helios repository. For helios repository the url is:
(http://download.eclipse.org/webtools/updates)
4. Click next and select WTP packages to install
5. After you are done restart eclipse IDE
6. Change the eclipse perspective
click on Window--> Open Perspective --> JEE
-end of file-
-------------------------------------------------------------------------------------------------------------------
2. Installing and configuring Apache Tomcat Server: 7.0.22
Pre-requisites:
you must have java 6 installed.
1. Download Apache tomcat 7.0.22 or higher version from http://tomcat.apache.org/download-70.cgi?Preferred=http%3A%2F%2Fapache.mirrors.hoobly.com%2F
2. Extract it and place it under /usr/local/tomcat7
3. For autostart create following script in /etc/init.d
[sudo vi /etc/init.d/tomcat7]
paste these following lines
***********************************************
# Tomcat auto-start
#
# description: Auto-starts tomcat 7
# processname: tomcat7
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat7/bin/startup.sh
;;
stop)
sh /usr/local/tomcat7/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat7/bin/shutdown.sh
sh /usr/local/tomcat7/bin/startup.sh
;;
esac
exit 0
************************************************
4. Save the file and set executable permissions
[sudo chmod 755 /etc/init.d/tomcat7]
5. Link the startup script to startup folders
[sudo ln -s /etc/init.d/tomcat7 /etc/rc1.d/K99tomcat]
[sudo ln -s /etc/init.d/tomcat7 /etc/rc2.d/S99tomcat]
6. Finally start the tomcat server
sudo /etc/init.d/tomcat7 start
7. Test the setup in browser
Open URL : http://localhost:8080/ -- you should be able to see the tomcat welcome page
----------------------------------------------------------------------------------------------------------------------------------------------------
3. Configuration for Running Tomcat from eclipse:
To work it around, you need to add the tomcat-juli.jar to the run configuration class path.
Here are the steps how to do it:
1. In Eclipse, Open the "Server" tab.
2. Double click on the "Tomcat7" entry to see the configuration.
3. Then click on the "Open launch configuration" link in the "General information" block.
4. In the dialog, select the "Classpath" tab.
5. Click the "Add external jar" button.
6. Select the file "/usr/local/tomcat7/bin/tomcat-juli.jar" (select from where your tomcat is installed)
7. Close the dialog.
8. Start tomcat 7 from Eclipse.
-----------------------------------------------------------------------------------------------------------------------
4. Installing Ant Build Tool:
1. download the latest version of Ant from:
http://ant.apache.org/bindownload.cgi
2. place it under:
/usr/local/
3. set the environment variable for ant
sudo gedit /etc/bash.bashrc
Add the following lines to bash.bashrc file:
export ANT_HOME=/usr/local/ant
set path=$path $ANT_HOME/bin
4. After setting up tomcat with eclipse and completed writing the web application:
open Terminal: ant -version (just checking if the installation is correct)
---------------------------------------------------------------------------------------------------------------------
5. Installing Spring Framework:
1) Download spring framework 3.0.6 from:
http://www.springsource.org/download
2) extract the zip file and keep the extracted file in /usr/local/
3) Inside extracted spring folder, there are four files:
i. dist
ii. docs
iii. projects
iv. src
4) To configure spring framework:
- simply add all jar files in the 'dist' folder to the the library (in eclipse) using build path
- Also add common-logging.jar file to the library (where is this jar file?-- spring framework 3.1.0.M2 -->projects-->spring-build-->lib-->ivy)
- Finally copy all the jar files in 'dist'+ common-logging.jar file and paste it in lib folder in eclipse ( where? in eclipse--war -->WEB-INF-->lib)
(Remember: one more jar file for Junit test which must be added to build path is: "junit-4.10.jar" , you can add it later)
Eclipse,Tomcat,ANT, Spring Framework Guide
Author: Anup Niroula
Author: Anup Niroula
In Linux, we need to install WTP plugins for JEE to create web applications.
# how to install Web Tools Platform(WTP) plugins in eclise ..?
1. Run the Eclipse IDE
2. Go to Help Menu-->Install new software
3. Give this url on 'work with' http://download.eclipse.org/releases/galileo/ and click 'Add' to download Java EE plugins from the repository
Note: There are two projects of eclipse: Galileo and helios. The one we are using is Galileo.
So, do not install plugins from the helios repository. For helios repository the url is:
(http://download.eclipse.org/webtools/updates)
4. Click next and select WTP packages to install
5. After you are done restart eclipse IDE
6. Change the eclipse perspective
click on Window--> Open Perspective --> JEE
-end of file-
-------------------------------------------------------------------------------------------------------------------
2. Installing and configuring Apache Tomcat Server: 7.0.22
Pre-requisites:
you must have java 6 installed.
1. Download Apache tomcat 7.0.22 or higher version from http://tomcat.apache.org/download-70.cgi?Preferred=http%3A%2F%2Fapache.mirrors.hoobly.com%2F
2. Extract it and place it under /usr/local/tomcat7
3. For autostart create following script in /etc/init.d
[sudo vi /etc/init.d/tomcat7]
paste these following lines
***********************************************
# Tomcat auto-start
#
# description: Auto-starts tomcat 7
# processname: tomcat7
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat7/bin/startup.sh
;;
stop)
sh /usr/local/tomcat7/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat7/bin/shutdown.sh
sh /usr/local/tomcat7/bin/startup.sh
;;
esac
exit 0
************************************************
4. Save the file and set executable permissions
[sudo chmod 755 /etc/init.d/tomcat7]
5. Link the startup script to startup folders
[sudo ln -s /etc/init.d/tomcat7 /etc/rc1.d/K99tomcat]
[sudo ln -s /etc/init.d/tomcat7 /etc/rc2.d/S99tomcat]
6. Finally start the tomcat server
sudo /etc/init.d/tomcat7 start
7. Test the setup in browser
Open URL : http://localhost:8080/ -- you should be able to see the tomcat welcome page
----------------------------------------------------------------------------------------------------------------------------------------------------
3. Configuration for Running Tomcat from eclipse:
To work it around, you need to add the tomcat-juli.jar to the run configuration class path.
Here are the steps how to do it:
1. In Eclipse, Open the "Server" tab.
2. Double click on the "Tomcat7" entry to see the configuration.
3. Then click on the "Open launch configuration" link in the "General information" block.
4. In the dialog, select the "Classpath" tab.
5. Click the "Add external jar" button.
6. Select the file "/usr/local/tomcat7/bin/tomcat-juli.jar" (select from where your tomcat is installed)
7. Close the dialog.
8. Start tomcat 7 from Eclipse.
-----------------------------------------------------------------------------------------------------------------------
4. Installing Ant Build Tool:
1. download the latest version of Ant from:
http://ant.apache.org/bindownload.cgi
2. place it under:
/usr/local/
3. set the environment variable for ant
sudo gedit /etc/bash.bashrc
Add the following lines to bash.bashrc file:
export ANT_HOME=/usr/local/ant
set path=$path $ANT_HOME/bin
4. After setting up tomcat with eclipse and completed writing the web application:
open Terminal: ant -version (just checking if the installation is correct)
---------------------------------------------------------------------------------------------------------------------
5. Installing Spring Framework:
1) Download spring framework 3.0.6 from:
http://www.springsource.org/download
2) extract the zip file and keep the extracted file in /usr/local/
3) Inside extracted spring folder, there are four files:
i. dist
ii. docs
iii. projects
iv. src
4) To configure spring framework:
- simply add all jar files in the 'dist' folder to the the library (in eclipse) using build path
- Also add common-logging.jar file to the library (where is this jar file?-- spring framework 3.1.0.M2 -->projects-->spring-build-->lib-->ivy)
- Finally copy all the jar files in 'dist'+ common-logging.jar file and paste it in lib folder in eclipse ( where? in eclipse--war -->WEB-INF-->lib)
(Remember: one more jar file for Junit test which must be added to build path is: "junit-4.10.jar" , you can add it later)
very nice tutorial for the start
ReplyDelete