Just Code it!

For this post I continue from where I left after installing JBoss in a previous article (Install JBoss and use it in Eclipse (Juno)). This is not a must though and it works in isolation, so you don’t need to look at the other one if you don’t need to.

Enough said, let’s start.


Tomcat– Downloading

Go to the  Tomcat website download page and scroll down where you can see the binaries ready to be downloaded:


I will downloaded the zip of the version 7.0.40:


Once the download completes, unzip its content in a reasonable location. I put mine in “C:\apache-tomcat-7.0.40″


 Tomcat – Configure Windows

In order to been able to launch Tomcat in isolation, you need to configure at least one environment variable.

So let’s do this.

Open the computer properties. You can do this opening the Start menu and right-clicking on the “Computer” button and selecting “Properties”:

In the new window click on the Advanced system settings link in the right panel:

In the System Properties window select the “Advanced” tab and click the “Environment Variables…” button:

In the new window click “New…” below the “User variables” section (or you can use the System variable if you want this to be set for everyone):

A new window will pop-up and here you will have to add a variable “JAVA_HOME” that points to your data sdk:

Press Ok and Ok again in the previous window and it will be ready.


Tomcat – Test it

To test that everything is correctly configured let’s just do a quick test run.

Go where it is located and enter in the bin folder: C:\apache-tomcat-7.0.40\bin

Double click the “startup.bat” batch file. If windows asks you confirmation to trust the file click OK (deselect the checkbox “Always ask before opening this file” if you don’t want to see this popup every time you launch it).

You should see a console window coming up and stay on screen:

To see Tomcat at work now, open a browser and go to:


You should see something similar to this:

When you are happy you can then shut it down executing “shutdown.bat” from the same bin folder.

The console window should disappear and we can move to the next step :)


Tomcat – Adding the server to Eclipse

Open Eclipse and open the “Servers” tab. If you have trouble finding it, use the same steps explained in another post: Install JBoss and use it in Eclipse (Juno)

Once you find it:

Add a new server (right-click menu):

In the new window select the Apache folder and select the Tomcat version that you installed. It is the 7.0 in this case:

If this is the screen that you see then the only thing you can do is click Next.

If you end up in a workspace where tomcat was already configured, the chances are that you will see another screen that will allow you to jump directly to the completion of the task, just clicking on Finish:

In any case, if you didn’t see this screen and what you see is the previous one, then click Next and you will be prompted to insert some info that eclipse needs in order to been able to interact with the server. Note that this screen is the same one you would see if you click on “Add…” on the other screen I just shown above.

Here make sure you enter the path where you extracted the Tomcat zip file.

Before proceeding, ensure you select the JRE you want to use. In my case I already configured eclipse to use the Java EE SDK, so it is ok in this case just leave the option set to “Workbench default JRE”.

After clicking on Finish you will see the Tomcat server displayed in the servers tab:

Job done!


Thanks for following and stay tuned for the next episode.

That post is exactly what the title says. We’ll install JBoss and configure the server in Eclipse.

From a chronological order, this post comes after:

And after or as an alternative to:

but I will assume that this is the first server you’ll configure in Eclipse.


JBoss – Downloading

Well, easy enough… just go to the website:
and download the version you want to use.

I’ll assume you will download the version 7.1.1  (zip):


JBoss – Installation

Just unzip the file in your preferred location. I’ll suggest to put it in the root of your HD. Ex: “C:\jboss-as-7.1.1.Final“.

That’s all… really!


JBoss – Configure Eclipse (JBoss Developer Studio)

Open Eclipse and navigate to Help->Eclipse Marketplace…:

In the windows that will pop up enter “jboss” in the search field and enter it.
The JBoss Development Studio should be easily visible.
When you spot it, just click on the Install button:

And just confirm it with Next:

Then finish it accepting the terms and clicking on Finish:

The installation will start…

You will be prompted to continue with the installation. Simply click on OK:

At the end of the Installation Eclipse will ask you to restart itself. Accept it.

When the restart will be complete JBoss Dev Studio will ask you to send them usage statistics.
Feel free to select any of the two options based on your personal preferences.

Now you can have access to the new JBoss Dev Studio Perspective!
Open Window->Open Perspective->Other…
Unless you can directly see it listed in the perspectives:

Then select JBoss in the new Pop up:

Now it’s done! And you can switch to the new perspective simply clicking on the JBoss button that you can see in the top right area of your screen:

This perspective is very useful especially because presents to you a nice portal that you can use to quickly start projects and documentation/examples.


JBoss – Adding the server to Eclipse

Click on the “Servers” tab that you should have visible in the bottom area of your screen:

You should see the other servers listed (if any) or a link that prompt you to add one server:

You can click on the link (if you see it) or right click in the white area and select the New->Server option:

In the new window select the JBoss server you intend to use. I’ll install the JBoss AS 7.1:

In the next window you will have to enter the path where you unzipped JBoss and make sure to select the correct JRE (the Java EE SDK we downloaded in another blog post):

You can the simply click on Finish (or continue with a couple of Next if you prefer).

After this you will see you server listed in the Servers tab:

Job done!


That’s all for this episode.

We’ll install more servers (just for fun) in other posts and will see how to write a Servlet to use with them. Stay tuned ;)

This post continues from we were after the posts:


GlassFish Server – Installing the Tools in Eclipse

After the setup of Eclipse and the JDK, within Eclipse open the marketplace:

And search “glassfish”. Those are the results you should see coming up:

You will have to click on the Install button for the GlassFish Tools for Juno (see picture above).

A confirmation window will popup with the options selected. I’ll leave all of them enabled and click Next:

Then of course accept the agreement and click Finish:

Then be patient while the installation takes place…

At the end you will be prompted to restart eclipse. Do it.

Once restarted, let’s add a new GlassFish Server.


GlassFish Server – Adding a reference in Eclipse

In order to do so switch to the Server tab (visible in the lower area of the IDE):

If you can’t see this tab for any obscure reason, you can still access to ti through the menu: Window->Show View->Servers:

If you don’t see this option neither, then click on the “Other…” option in the same menu list ( Window->Show View->Other…) and in the search window type “servers” or look in the Server section. Select the “Servers” component and click OK:

In this window you should see a link to “new server wizard…” if you don’t have any server configured:

Otherwise (or anyway in any case) you can right-click in the server window and select New->Server:

The server wizard window should come up.

Select one of the GlassFish options. I’ll select the version 3.1.2. Click Next once selected:

In the next window you will have to provide eclipse with the information about the location of your glassfish installation (where you extracted it) and the JRE to use.

By default it will suggest the default ones, but I selected the jdk7 this time.

Click Next once finished. Note that the folder must be the glassfish one and not the parent folder (see picture). Eclipse will help you if you select the wrong folder anyway.

Nothing much left to do here, except inserting the correct admin name and password and click Finish.

Note that if you click Next, you will have the possibility to associate immediately some projects with this server, but I don’t have any project that I want to associate in this moment.

At this point the server should be visible in the Servers Tab:


GlassFish Server – Starting it in Eclipse

If you double click on it you will see a nice window that will show you some of the options you have access to:

Another nice thing we can explore at this point is the server admin panel as well.

In order to do so we need first to start the server.

One way of doing this is selecting our glassfish server in the servers tab, and clicking on the big green play button on the right (or pressing Ctrl + Alt + R as visible in the tooltip):

An alternative way is rigth-click on the server itself and selecting the Start from here:

The Console should get focus automatically and if everything is as it should, then you should see some nice logs to communicate that everything worked as expected.

If not, and you see something like this:

Or even this:

Then open again the option window (double click on glassfish) and modify one of the connection options.

Untick the “Use Anonymous Connection for Admin Commands” option and of course make sure that the username and password are the correct one.

Save the change (or simply close the window and save when prompted) and retry to start the server.

Wait of course for the indicator in the lower right corner to complete:

And this time if this time everything goes fine the servers tab should now show that our glassfish instance is started (and synchronized):


GlassFish Server – Interacting with it with the Admin Console

A nice thing to explore now is the glassfish admin console (on the running server).

You can do this directly in eclipse, right-clicking on the glassfish server and navigating to the option GlassFish->View Admin Console:

A new window should open in the eclipse IDE and should connect to the glassfish home url (localhost:4848 in my case):

From here, inserting the correct credentials and logging in, you will have access to your admin console in all ts wonder!


That’s it for now. You can enjoy to explore the numerous options here and I’ll continue the tutorial with the creation of a servlet to run on this (and other) servers in another post.


Thanks for tuning and see you next time!


That’s is the first of a set of few posts that will focus in installing and configuring Eclipse in order to been able to build Dynamic Web Pages with Java EE SDK using Tomcat 7.0, JBoss or GlassFish.

In this first post I’ll focus only in the initial step of downloading and configuring Java EE and Eclipse (Juno).


Java EE SDK – Download

The first thing to do is going to the Java download page:

and select the “Java Platform, Enterprise Edition 6 SDK Update 4 (with JDK 7u11)” or newer version:

Or directly go to the download page (if that’s the latest version):

Here just accept the license agreement:

and download the file you need.

If you are in windows you will probably need the “Windows” (or “Windows – Multi-Language”) version for a normal Windows 32bit version. If your system is 64bit, then you can decide to go for the x64 versions.

Java EE SDK and GlassFish – Install

When the download is completed, run it and simply follow the instructions, they are quite straightforward.

Some key points are:

  • You will want probably to select: “Typical installation
  • Leave the installation directory to the default one: “C:\glassfish3
  • Leave the Install and Enable Update Tool options checked as they are (with no proxy settings)
  • Leave it create the default domain (domain1) using a sensible username (“admin”… if it is sensible :)) and possibly a more meaningful password
  • If you are prompted by Windows Firewall about allowing access… allow it

Once finished you should be able to go to “localhost:8080” and see the glassfish default page:


That’s really it for it. The next Post will be dedicate to Installing and configuring Eclipse (Juno).

You can find it here:

Installing Eclipse (Juno) and configure it with Java EE SDK