Java JBoss

Hello, World! Web App

Ten Quick Steps for Deploying a Super Simple
JSP Web App (WAR) on JBoss AppServer

Updated for JBoss 7.1.1 on Java 7

Tutorial

Follow these steps to install JBoss and create and test a simple web application (WAR).  The steps are designed for Windows XP, but you should be able to modify them for other OSes without too much effort.

1) Install Java

Download "Java Platform (JDK) 7u21" from:
http://www.oracle.com/technetwork/java/javase/downloads/

Run the jdk-7u21-windows-i586.exe installer with the default options, which will install Java into: C:\Program Files\Java\jdk1.7.0_21\

Note: Application servers, like JBoss, require the full JDK (Java Development Kit), which contains the JRE (Java Run-Time Engine) plus a bunch of stuff for developers, such as the javac compiler.

2) Install JBoss Application Server

Go to the JBoss download page at:
http://www.jboss.org/jbossas/downloads

For the "7.1.1.Final" version, locate the "AS Certified Java EE 6 Full Profile" and download the "ZIP" file.  Unzip the file into: C:\Apps\JBoss\

3) Create Work Folder

Create a folder called HelloWorld separate from your JBoss installation.  For example, the full path of your work folder could be: C:\Projects\HelloWorld

4) Create Startup Script

In the HelloWorld folder create a file named JBoss.cmd with the following content:

JBoss.cmd
@echo off
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_21
set JBossHome=C:\Apps\JBoss\jboss-as-7.1.1.Final

set Path=%JAVA_HOME%\bin;%Path%
cd %JBossHome%\bin
standalone.bat

This script will launch JBoss.

5) Launch JBoss

Run the JBoss.cmd file you just created.

6) Write JSP File

Also in the HelloWorld folder, create an HTML5 file named hi.jsp as:

hi.jsp
<!doctype html>
<html>
<head>
<title>JSP Test</title>
<%!
String message = "Hello, World.";
%>
</head>
<body>
<h2><%= message%></h2>
<%= new java.util.Date() %>
</body>
</html>

This JSP simply displays a greeting along with the current date and time.

7) Create Deployment Descriptor

In the HelloWorld folder, create a subfolder called WEB-INF, and in that folder create a file named web.xml as:

web.xml
<web-app>
<display-name>Hello World</display-name>
</web-app>

The deployment descriptor provides information to JBoss about your web application.

8) Create WAR Builder & Deployer

In the HelloWorld folder, create a file called Deploy.cmd as:

Deploy.cmd
@echo off
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_21
set JBossHome=C:\Apps\JBoss\jboss-as-7.1.1.Final

"%JAVA_HOME%\bin\jar.exe" -cvf helloworld.war *.jsp WEB-INF
copy helloworld.war "%JBossHome%\standalone\deployments
pause

This script uses Java's JAR utility to zip up the appropriate contents into a WAR file.

9) Do It

Run the Deploy.cmd file.

10) Test Your Web Page

Screenshot thumbnail

Open "http://localhost:8080/helloworld/hi.jsp" to see your web application run.

If you want to explore explore the JBoss console, you first need to create a Management User.  Copy the JBoss.cmd file to AddUser.cmd.  Change the last line to be add-user.bat and run the file.  After you have created your user, go to "http://localhost:8080" and click "Administration Console".  Now click "Manage Deployments" to see your new "helloworld.war" application listed in the main panel.

That's It

For your convenience, here's the completed Hello World! Web Application:
HelloWorldWebApp.zip

Questions or Comments:

Send Us a Message

Powered by PERFECT

All the fields are optional.  However, if you want a response, make sure to provide your e-mail address.

Random

DMOZ
Google

"Muchas Gracias"
J.C., June 28, 2009

"Very usefull for the beginners."
R.R., June 22, 2009

"Very very usefull documentation for fresher, and it helped me a lot"
R., June 19, 2009

"Great tutorial"
H.M.R., June 9, 2009

"Superb simple steps Jboss sample, thanks!"
J., June 2, 2009

"Excellent Tutorial.  Simply superb.  I was struggling to do this earlier.  Now I can comfortably deploy applications to jboss.  Thanks a lot."
N.R., April 27, 2009

"You Rock !!!!!!!!!! Very good in layman terms .........."
U.M., March 19, 2009

"Works in first attempt..  Great one!!!"
B., March 19, 2009

"Thanks a lot - worked the first time!"
T., March 12, 2009

"This really cut to the chase, the definition of K.I.S.S! for the newbie, just what I needed, thanks!"
J.C., March 9, 2009

"this was really helpful....  I was looking forward to start from a scratch and I succeeded in it...  thanks a ton...."
R., February 10, 2009

"So simple even I could do it!"
S., January 26, 2009

More...

"A huge motivational startup for beginners of java, jboss.."
S., December 18, 2008

"very nice tutorial.  I was able to run jsp within two mins.  Thanks a lot"
G.P., November 20, 2008

"It is a good tutorial.  I changed few things in this tutorial to display hello world in Fedora core 6, but with out this tutorial it would be of mess."
N.M., November 17, 2008

"Very good for the beginners.  It's like spoon feeding."
P., October 1, 2008

"very good step by step appraoch.  make things easy to follow and implement."
I., September 21, 2008

"Simply the best JBOSS JSP example: it works!!"
L.D., September 21, 2008

"Fantastic, a little time spent.  A lot learned."
J.H., September 9, 2008

"3 minutes until I had my system "verified" with this hello world on a Linux-box.  Cool, Thanks from Zurich !"
F.P.R., August 5, 2008

"You showed me the path and I made my first painless step with JBoss.  Thank you Master.  Seriously:I wish there were more simple tutorials like this.  Great job!"
R., August 1, 2008

"Quick and simple.  I enjoyed it.  Thx."
S.L., July 31, 2008

"The best tutorial for starters...short and yet powerful, covering all necessary concepts."
D., July 27, 2008

"Thanks for nice tutorial.  It took me just a few minutes."
Z., July 16, 2008

"Thank you very much for this tutorial.  The best part is that its so simple and just works!!!"
J.R., July 13, 2008

"Simple to-the-point intro to JBoss web application."
L.C., June 29, 2008

"very nice.  within 2 min i run my first hello world."
December 19, 2007

"Great little example to get you started, thanks!"
P., November 13, 2007

"Congratulations, your tutorial is very good and simple !!"
F., October 25, 2007

"It's really helpful...  The easier way u have explained all the steps is really useful."
R., October 15, 2007

"Very Effective Crisp Steps.  Thanks!"
V.B.S., October 8, 2007

"thanks a lot....this is simple and easy....this helped me a lot!!!!!!!!!  i got exactly what i had been searching for!!!!!!!!"
V.A., October 7, 2007

"The tutorial writer has served a a great cause in favour of developer community by writing this masterpiece tutorial.  Hats off to you boss!"
M.T., September 5, 2007

"OMW......THIS IS REALLY EASY.....THANKS SO MUCH......this help me a lot!!!"
J., August 31, 2007

"Wow, really that simple!  thanks a lot"
P.S., July 18, 2007

"A powerful crash-course for deploying web application to jboss for biginners.  A bottle of water for a thirsty."
N.S., July 17, 2007

"At last!!  A simple, yet superb, JBoss tutorial!  Thanks a lot"
J.M.F., July 11, 2007

"This is the best page I have ever read!"
D., June 15, 2007

"very good tutorial for starter, helped me...  Thanks a lot"
Z.C., June 7, 2007

"thank u very much for this simple and very helpfull one for which i looked for and the right one at right time.."
M.U.R., May 30, 2007

"Thanks a lot...it was a great help...a stepping stone towards JBoss"
H.H.D., May 23, 2007

"Thank you for posting a TRUE Helloworld WAR Example using JBoss.  Just the facts was all I needed, Great Job"
B.E., May 14, 2007

"This tutorial is realyy excellent"
A.S., December 27, 2006

"This tutorial is really superb for the peoples whao are new to JBoss.  Really Excellent."
V.L., December 7, 2006

"This works awesome.  great for a start on JBoss!!"
A., November 30, 2006

"Wonderful article, and it is no time waste info.  Cool."
S., October 31, 2006

"Fun ... Tastic, that's something that is not explained in the jboss tutorial, not like this anyway ;-)"
O., September 12, 2006

"Cool!  Very very nifty!  Excatly what I wanted.  Thanks"
B., September 12, 2006

"Awesome Tutorial!  Just what the doctor ordered :)"
L., August 31, 2006

"Great first step in learning development using JBoss"
V.M., August 31, 2006

"This is cool... Thanx"
M., August 14, 2006

"Cool!  Exactly what I needed!"
A., August 13, 2006

"Thanks a lot!  This very informative and simple for newbies like me."
P., July 29, 2006

"Thank you very much for this sample.  It's a perfect self-contained application that I needed to fit all the pieces together and get started!"
S.K., June 29, 2006

"Wow, this is greate information for beginners.  I surffed many sites but didnt get exact way to deploy application.  From this site i got what i wanted.  I appriciate it.  Thanks a lot!!!"
H., June 26, 2006

"This is way too cool.  I mean this is exactly the kind of thing I've been looking for.  Thanks for the great work"
S.E., June 3, 2006

"Great Article"
S.A., May 24, 2006

"Really this article is amazing.  Excellent!!!"
P.S., May 6, 2006

"i have been crazy for last few days and this article saved me going mad.  EXCELLENT WORK!!!!!"
J., March 26, 2006

"That's an absolutely incredible tutorial.  Super stuff !!"
K.S.M., March 24, 2006

"simply superb."
P.G.P., March 16, 2006

"Great guide.  Thanks, it was very helpful."
D.N., March 5, 2006

"It's really that simple !  I've wasted weeks looking at 'official' documentation - thank you for making my job easier !"
P.G., January 30, 2006

"Your site really helped me.  As a beginner in using JBoss i surfed through many sites to know how to get a JSP file executed.  Thank you!"
T.T., January 25, 2006

"Thanks very helpful."
N., January 24, 2006

"This is really great article.  I dont know anything about JBOSS.  in 15 min i wrote program and saw the output."
R.T., January 19, 2006

"EXCELLENT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
I., January 12, 2006

"really neat, easy to understand, thanks a lot, great stuff for beginners"
J.M., January 12, 2006

"Thanks a lot, this was what I was looking for."
S.B., January 11, 2006

"That was Excellent.  It was the first time that I used JBoss.  And You made it easy for me.  Keep it up."
D.K., January 9, 2006

"These steps are very good."
B., January 6, 2006

"Thanks a lot for this concise reference on jsp deployment on JBoss."
A., December 30, 2005

"Thanks -- simple but great work"
M.S., December 29, 2005

"Hi, This is nice coding and helped me a lot to understand the process.  Thank you very much."
M.J., December 20, 2005

"This was EXACTLY what I needed; a super quick example of deploying an app to JBoss.  Thanks a ton!"
T., December 13, 2005

"It is very simple, good"
M.K., December 12, 2005

"That was quick!!  Thanks."
G., December 9, 2005

"Thansk a bunch for the help.  this was simple and very informative.  it will help beginners a lot."
J.A., November 27, 2005

"exceptionally simple for beginners"
G.S., November 18, 2005

"Its very nice.  Helpfull to every one for the beginers to jboss with jsp.  Its simply gr8."
P.I., November 16, 2005

"Great it seems simple when somebody shows you."
M., November 14, 2005

"Simply Superb.  Good Guide for beginners.  Thanks a lot."
R., November 10, 2005

"Thanks a lot.  this was very helpful."
S., November 9, 2005

"Thanks a lot for this example straight forward and clear."
Anonymous, November 6, 2005

"Excellent example!  Thanks!"
F., November 3, 2005

"thank you.  this was really helpfull"
S.H., October 31, 2005

"Excellent HelloWorld!  Thanks buddy"
Anonymous, October 24, 2005

"At last - a really simple JBOSS jsp example"
M.H., October 24, 2005

"If only all quick guides were as simple and as easy to follow.  Thanks!"
G.M., October 18, 2005

"its really nice for a begginer."
V.N., October 17, 2005

"Hi, This is the nice coding and helped me a lot to understand the process."
V.S.K., October 9, 2005

"Thank you very much.  Your site helped me in the deployment part..."
P.M., October 2, 2005

"really grrrrrrrrrrrrrrrrr8 i learned deployment concept sooon thanx"
L.B., September 21, 2005

"Thanks for the wonderful example ... it makes it appear so simple!"
R., September 20, 2005

"You made my day"
S., September 9, 2005

"Great 10 steps, you have saved me so much time to be able to deploy my first jsp file on Jboss"
I., August 18, 2005

"I think it cannot be explained in any other way.  so tough but explained so simply.  Thanks a lot"
M.P., August 17, 2005

"Thanks for your very useful notes for jboss server, here i took only half an hour its sucessfully running.  thanks for your easy notes.  Everyone can easily read and understand these notes.  its very useful for all kinds of java developers."
G., August 17, 2005

"thanx alot....  i searched lots of things for simple example to run in jboss...  this example made a smooth start...  thanx Again"
P., July 28, 2005

"Wow, even I got it running ;)"
Anonymous, July 21, 2005

"Thanx  ...Its really painful to look for a solution otherwise.....This is really simple"
V., July 18, 2005

"Great Start, Thanks"
M.S.C., June 30, 2005

"Really a Fantastic Basic Way to Deploy..Thanx"
T.A., June 24, 2005

"This is the good hello world"
K.S., June 14, 2005

"Very Helpful for a starter.  One feels very confident when your application works the first time"
S.H., May 27, 2005

"Very clear and very helpful."
Anonymous, May 23, 2005

"Very useful for a fresher"
S., April 30, 2005

"thank you, that was very helpfull  :-D"
R., April 29, 2005

"Thank you very much for your clear and crisp steps to deploy a web-applicatin in JBoss.  I am greatful to you for this support..."
E., April 27, 2005

"Thanks, that was a great tutorial for a beginner to JBoss like myself.  It's really helped, thank you!!"
K.D., April 24, 2005

"This is wonderful.  Thanks a lot"
B.C., April 10, 2005

"Exactly what was needed.  Thank you very much."
R.B., April 8, 2005

"Cool article!  The only suggestion is... Use jar..."
S.G.V., March 17, 2005
Excellent suggestion, implemented March 18.  -- Dem

"It's really simple and useful for beginner."
A., March 15, 2005

"Thank You So Much.  Short and Sweet"
A.S., March 14, 2005

"strait to the point.  ideal for quick hand-take.  Thanx!"
M.L., March 11, 2005

"Thank you!  This is useful."
S., March 8, 2005

"Hey!  It is really simple :))))  Thanks a lot!"
M.G., February 24, 2005

"Simple and sweet - thanks!"
C.P., February 20, 2005

"Thank you!!!  i have to change a few thing to make it work on linux but now I finally have my Hello world"
V., February 15, 2005