Developing Software in J2EE

Developing Software in J2EE

Environment Consistency – NetBeans (Windows)

We need to make our life easier by creating consistency for every machine. What this means is every machine you try to use, whether it be yours or your colleagues, the environment will be the same when you sit down to help them with something. This is very important if you’re a Development Manager and you’re trying to help one of your staff.

This is one of several posts in regards to this subject.

Our IDE is going to be NetBeans. I will be the first to admit that NetBeans has issues sometimes and it can be frustrating. Maybe Eclipse is easier to use but I have been using NetBeans for a while and it’s built to write JAVA code so that’s what we’re going to be using. We will be using Version 6.7.1 of NetBeans but we’ll upgrade in a later post, I’m sure, when a new version becomes available.

Trying to work with as close to the default installation is really the best way to go. If you do that, you’ll have fewer problems, and if your system gets hosed then you can get your system back up and running quicker.

So for Windows we download the file netbeans-6.7.1-ml-windows.exe from NetBeans.org. We discussed installing NetBeans already for the Macintosh in an earlier post.

Start the installation process by clicking on this file. You’ll then see a screen while the installer is being configured:

Configuring NetBeans Installer

Configuring NetBeans Installer

also, while the installer is being configured you may see this screen:

Windows Firewall

Windows Firewall

All that’s going on here is that a check is being made to see if there is a new JDK out there.  Just click on Unblock and move on.

When the installer is done being configured you’ll see this screen:

Welcome to NetBeans Installer

Welcome to NetBeans Installer

I don’t like to install things that I don’t need.  So we’re going to click Customize here which will bring up this screen:

Configuring NetBeans Options

Configuring NetBeans Options

and then we’ll see this screen after we hit OK:

Welcome To NetBeans Installer

Welcome To NetBeans Installer

These are the only options that I want installed.  There seems to be a movement towards Glassfish but I haven’t gotten a chance to play with it yet so I’m not going to install it.  I also don’t want to install the version of Tomcat that NetBeans comes with.  But feel free to install any of these options if you want to, it really won’t hurt anything.  But keep it consistent in your environment.

Welcome To NetBeans Installer

Welcome To NetBeans Installer

So now we’ll click Next to get to the Software License Agreement screen:

Software License Agreement

Software License Agreement

Click on the checkbox for “I accept the terms in the license agreement” and click on Next to see this screen:

Installation Location and SDK

Installation Location and SDK

Make sure that it is configured to use the JDK we installed in a previous post.  It probably is by default but if it isn’t then you’ll need to Browse to find it.

NetBeans does a good job of keeping its customizations in a separate directory from the main install so I usually just leave the install directory as the default.

After you’ve made those adjustments, click Next and you’ll see the Summary screen:

Installation Summary

Installation Summary

Now we click Install and the installation process starts and you’ll see screens that look like this for a few minutes:

Installing NetBeans

Installing NetBeans

Once the Install is finished, you’ll see this screen.

Completed Install

Completed Install

Check or uncheck those boxes as you see fit and click Finish.

And we’re done.. or not. We need to start up NetBeans because we need to initialize part of it for when we configure Tomcat later.  So click on Start, All Programs, NetBeans and then click on NetBeans IDE 6.7.1 and you should see the following screen:

Starting Up NetBeans

Starting Up NetBeans

I’m sure at some point we’ll discuss the NetBeans start up procedures but for now it is starting up and it will take a couple of minutes. Just so you know, it takes a bit to start up when you have first rebooted your machine and then on subsequent starts it will be faster. After it is done you’ll see the following screen:

NetBeans Main Window

NetBeans Main Window

This is the main NetBeans window.  We need to initialize NetBeans for J2EE use and we do that by clicking on File, New Project and Java Web.

Note: Sometimes you do not have to do this.  I know during the Macintosh install of NetBeans that I did but for my Windows install I did not.  However, I know there have been times during the Window install that I did.  I’m telling you this because I couldn’t get the screen capture I wanted here. :)

After it’s done Activating Java Web and EE it will come to a screen for creating a new project. Just cancel out of it for now.

We have one last thing to configure. This is a personal preference of mine but I believe that it is time to leave the 80 column limit behind. Let’s expand out to 120 shall we? Click on Tools, Options, Editor and then Formatting. Put 120 in the Right Margin box and you’ll see this screen:

Fix columns width in editor

Fix columns width in editor

Click OK and now we’re done configuring. We’ll come back to NetBeans after we install Tomcat in a later post.

One more thing, if you want a clean install remove the .netbeans directory under c:\Documents and Settings\%USERNAME% where %USERNAME% is the name of the user you are logged in.  (For example mine is thcampbell).  After doing this, all you have to do is restart NetBeans and you basically have a fresh install.

October 25, 2009 Posted by | Development Environment | , , | Leave a Comment

Environment Consistency – NetBeans (Apple Macintosh)

We need to make our life easier by creating consistency for every machine.  What this means is every machine you try to use, whether it be yours or your colleagues, the environment will be the same when you sit down to help them with something.  This is very important if you’re a Development Manager and you’re trying to help one of your staff.

This is one of several posts in regards to this subject.

Our IDE is going to be NetBeans.  I will be the first to admit that NetBeans has issues sometimes and it can be frustrating.  Maybe Eclipse is easier to use but I have been using NetBeans for a while and it’s built to write JAVA code so that’s what we’re going to be using.  We will be using Version 6.7.1 of NetBeans but we’ll upgrade in a later post, I’m sure, when a new version becomes available.

Trying to work with as close to the default installation is really the best way to go.  If you do that, you’ll have fewer problems, and if your system gets hosed then you can get your system back up and running quicker.

So for the Apple Mac we download the file netbeans-6.7.1-ml-macosx.dmg from NetBeans.org.  We’ll discuss the Microsoft Windows environment in a later post.

Start the installation process by clicking on this file and then clicking on the package.  You’ll then see the Welcome screen:

Welcome to NetBeans Installer

Welcome to NetBeans Installer

Click Continue and then you’ll see the Software License Agreement screen:

Software License Agreement

Software License Agreement

Click Continue here and you’ll be asked to accept the Software License Agreement:

Agree to Software License Agreement

Agree to Software License Agreement

Click Agree here and now you’ll be asked to Select a Destination for your install.  Probably the default is the best way to go:

Choose Installation Destination

Choose Installation Destination

Click Continue here and the installation will start and you’ll see messages pop up on the screen like the following:

Install in progress

Install in progress

After a few minutes you’ll see this screen:

Installation Complete

Installation Complete

And we’re done.. or not.  We need to start up NetBeans because we need to initialize part of it for when we configure Tomcat later.  So in Finder, click on Applications, NetBeans and then NetBeans 6.7.1 and you should see the following screen:

Start Up NetBeans

Start Up NetBeans

I’m sure at some point we’ll discuss the NetBeans start up procedures but for now it is starting up and it will take a couple of minutes.  Just so you know, it takes a bit to start up when you have first rebooted your machine and then on subsequent starts it will be faster.  After it is done you’ll see the following screen:

NetBeans Main Window

NetBeans Main Window

This is the main NetBeans window.  We need to initialize NetBeans for J2EE use and we do that by clicking on File, New Project and Java Web.  The screen will look like this:

Open New JAVA Web Project

Open New JAVA Web Project

Click Next and you’ll see this screen:

Initialize for J2EE

Initialize for J2EE

After it’s done Activating Java Web and EE it will come to a screen for creating a new project.  Just cancel out of it for now.

We have one last thing to configure.  This is a personal preference of mine but I believe that it is time to leave the 80 column limit behind.  Let’s expand out to 120 shall we?  Click on NetBeans, Preferences, Editor and then Formatting.  Put 120 in the Right Margin box and you’ll see this screen:

Fix column width in editor

Fix column width in editor

Click OK and now we’re done configuring.  We’ll come back to NetBeans when we install Tomcat in a later post.

One more thing, if you want a clean install remove your ${HOME}/.netbeans directory but this will give you a clean install and you’ll need to re-initialize the J2EE environment like above and any other changes you might have made.

October 18, 2009 Posted by | Development Environment | , , , , | 1 Comment

Environment Consistency – The SDK

We need to make our life easier by creating consistency for every machine.  What this means is every machine you try to use, whether it be yours or your colleagues, the environment will be the same when you sit down to help them with something.  This is very important if you’re a Development Manager and you’re trying to help one of your staff.

This is one of several posts in regards to this subject.

Well obviously we’re going to need the Java Development Kit to develop our software.

For the Apple Mac, in my situation, I’ve upgraded to Snow Leopard.  This allows me to have Java 1.6.0_15 on my machine already pre configured the way I want it.

The Windows machine is always a different matter as Microsoft and Sun haven’t been friends for a while.  Anyway, we want to stay consistent with all our machines so we download the Java 1.6 SDK at http://java.sun.com.

The filename that I’ve downloaded is jdk-6u16-windows-i586.exe.  This is Release 16 (instead of Release 15 that is on the Apple Mac) but it’s close enough.

Double click on it and start the installation process:

JDK Installation - 1
SDK Installation – 1

Click Run here.

JDK Installation - 2
SDK Installation – 2

Click Next here.

JDK Installation - 3
SDK Installation – 3

Click Accept here.

JDK Installation - 4
SDK Installation – 4

Click Next here.

JDK Installation -5
SDK Installation -5

Click Next here.

JDK Installation - 6
SDK Installation – 6

Click Finish and you’re done installing the SDK.

One more thing to do.  To make your life easier, you need to set a couple of environmental variables.  You get to the environmental variables by doing the following:

Click on Start, Control Panel and System and the System Properties window will come up:

System Properties
System Properties

Click on the Advanced tab:

Advanced Tab
Advanced Tab

And then click on the Environment Variables button which will bring up the Environment Variables dialog.  Then cick on New and enter JAVA_HOME in the Variable name: field and C:\Program Files\Java\jdk1.6.0_16 in the Variable value: field

Environment Variables
Environment Variables

Click OK and now in the System variables window scroll down and highlight the one labeled Path and click Edit

System Path Variable
System Path Variable

At the start of the Variable value field put the following: C:\Program Files\Java\jdk1.6.0_16\bin

System Path Variable
System Path Variable

Click OK, OK, and OK.

The primary reason for doing this is so that when you start up a DOS box (which you may need to do) that you’ll be able to easily get to our Java utilities.

Again, the idea is to keep things consistent so we’re going to be using JDK1.6.0_15 (or JDK1.6.0_16) on all of our machines including staging and production.  So, if you want to, you can go ahead and download the SDK for these Operating Systems now.  We’ll go over those machines in a later post.

October 11, 2009 Posted by | Development Environment, Java | , , , | Leave a Comment

Environment Consistency – All The Posts

This post is to gather all of the other posts in regards to Environment Consistency into one place for easy reference. If you follow these posts down the list (published date) then you’ll be able to set your environment up fairly nice and quick.  As I post each week I’ll update this post.

Environment Consistency – The SDK

Environment Consistency – NetBeans (Apple Macintosh)

Environment Consistency – NetBeans (Windows)

Environment Consistency – Directories (Apple Macintosh)

Environment Consistency – Directories (Windows)

Environment Consistency – Sync Directories

Environment Consistency – PHP (Apple Macintosh)

Environment Consistency – MySQL (Apple Macintosh)

Environment Consistency – PHP/MySQL Configuration (Apple Macintosh)

Environment Consistency – Verify PHP to MySQL Connectivity (Apple Macintosh)

Environment Consistency – MySQL (Windows)

Environment Consistency – Apache HTTP Server (Windows)

October 11, 2009 Posted by | Development Environment | , , , , , , , | Leave a Comment

Development Machine

We’ll start with the machine that you’re going to be using to developing software.

For most people this is going to be a Microsoft Windows machine.  This is perfectly acceptable!  But I’ll warn you, there are some caveats that you’ll have to deal with and I’ll go over those in a later post.
I used a Microsoft Windows machine for years (about 20).  I avoided the Apple environment like the plague.  The reason?  Well, I know a lot of Operating Systems and I really didn’t want to learn another one.  Another reason is that I think the Apple hardware is far too expensive.  However, the company I was working for decided they wanted me to do some iPhone development and you can only do that on an Apple Macintosh.  So, I had no choice but to use one.
And I hate to admit it but I love the damn thing.  Part of the reason is because the Windows PC hardware my company provides is crap.  Just out and out crap.  However, on top of that, having a UNIX kernel underneath of the UI is very helpful.  I can run VMWare VMFusion for those utilities that there are only Windows versions (and there are several).  But the biggest reason?  Tomcat runs much better on the Apple (because of the UNIX kernel) then it does on Windows.
Tomcat has some quirks (that I’ll discuss those in a later post) that you have to get around when you’re developing on the Windows environment.  An example is if you’re developing software that uses RMI.  If you are, then you can not (or at least I haven’t figured out how) develop software with just one machine.  (And even in the Apple environment it can be a little tricky.)  Again, I’ll get to this in a later post and if someone knows of a way around the issue I’ll be happy to hear about it.
Anyway, this post is to help decide which machine to develop your software on.  My recommendation is an Apple Macintosh running OS X.  I do support my other developers using Microsoft Windows though so I’ll talk about that some in later posts as well.

For most people this is going to be a Microsoft Windows machine.  This is perfectly acceptable!  But I’ll warn you, there are some caveats that you’ll have to deal with and I’ll go over those in a later post.

I used a Microsoft Windows machine for years (about 20).  I avoided the Apple environment like the plague.  The reason?  Well, I know a lot of Operating Systems and I really didn’t want to learn another one.  Another reason is that I think the Apple hardware is far too expensive.  However, the company I was working for decided they wanted me to do some iPhone development and you can only do that on an Apple Macintosh.  So, I had no choice but to use one.

And I hate to admit it but I love the damn thing.  Part of the reason is because the Windows PC hardware my company provides is crap.  Just out and out crap.  However, on top of that, having a UNIX kernel underneath of the UI is very helpful.  I can run VMWare VMFusion for those utilities that there are only Windows versions (and there are several).  But the biggest reason?  Tomcat runs much better on the Apple (because of the UNIX kernel) then it does on Windows.

Tomcat has some quirks (that I’ll discuss those in a later post) that you have to get around when you’re developing on the Windows environment.  An example is if you’re developing software that uses RMI.  If you are, then you can not (or at least I haven’t figured out how) develop software with just one machine.  (And even in the Apple environment it can be a little tricky.)  Again, I’ll get to this in a later post and if someone knows of a way around the issue I’ll be happy to hear about it.

Anyway, this post is to help decide which machine to develop your software on.  My recommendation is an Apple Macintosh running OS X.  I do support my other developers using Microsoft Windows though so I’ll talk about that some in later posts as well.

October 5, 2009 Posted by | Development Environment | , , , , , | Leave a Comment

   

Follow

Get every new post delivered to your Inbox.