Configuring a Modern Java Development Environment in Windows with Windows Subsystem for Linux

I am a Java developer, and the impedence mismatch between Linux and Windows is still there, but the Linux is actually useable as a shell in Windows now, thanks to the RedStone 2 Release of Windows (aka the Creators Update or Version branch 1703). Now I’m not saying this is perfect – not by any means. The filesystem abstraction means that this stuff is way slower than you will get when compared to a barebones Linux or OSX environment. But sometimes you don’t have a choice. And this should only get better over time – believe me.  My friends working at Microsoft are using Linux just as much as I am.  Below, I’m detailing how to get your Java environment set up to use in Windows 10 when targeting a Linux installation.

Install Ubuntu in the Windows Subsystem for Linux
if you aren’t using a POSIX environment, it is suggested that you either install Bash for Windows, also known as the Ubuntu Subsystem using the Windows Subsystem for Linux (WSL). I make this distinction because, as of the latest release of Windows, they are starting to support multiple Linux distributions. Please note, some issues have been encountered when enabling Developer Mode, especially in locked down corporate environments – please see this and specifically choose the edit your registry option.

Continue reading

Scrum – A Quick Review of the Concepts


The goal of this article is not to reiterate what a bunch of other professional Agile Management coaches have already said, but rather to put all of the pieces onto one page.  Should you want to know more about these concepts, please feel free to Google them further, and you will find a plethora of information regarding each one and the arguments over the idiosyncrasies of the interpretation of each definition.  I’ll leave that to you to discuss further on forums and chats.  However, this should provide most folks with a quick ramp-up on Agile methodologies. Please use this as more of a reference

A Quick Video

If you’ve never done any Scrum work before, I suggest you watch this 10 minute video to get a quick overview.


There are many different types of people involved in the Scrum process, and this is the main way that you should think of them as how they relate to the Scrum process as a whole. Continue reading

Adding Swap Space to your Server

I seem to keep coming across this problem with web servers where I set something up on AWS and it runs poorly.  This is usually because I forgot to set the swap space.  Swap space is a system that the operating system uses so that it doesn’t have to keep everything in memory. It will write the least used information to disk. We all know (I hope) that disk is a factor of 1000x slower (unless you use SSDs, which it is just a factor of about 10x slower), so it’s important to keep track of how much memory your system is using. However, it’s still better than running out, which means that your applications aren’t slow… they are broken. There are a couple of other websites that document this, with some varying similarities to what I do.  So, I figured I’d share it (and thus not forget it again).

Note that you can either run this as root or add “sudo” to the front of each of these commands…

First, display the swap information for the current device.  If this is a standard AWS server, nothing will be printed.  If you or someone else has already added some swap space, it will be printed here.

Next, convert and copy a file, in this case I will use the null file, to the location where I want my swap file to be.  In this example, I will use “/swapfile”. Also, for this file should copy in block sizes of 1MB and end up copying 1024 blocks. This would be a total of (1024 blocks * 1024MB =) 1GB. Feel free to modify these numbers to match the swap size that you want.

Next, create a swap file at the location that you want (again, I’m using “/swapfile” for this example)

Next, turn on the swapping for this location

Lastly, you need to edit the file systems table (fstab) configuration file, which is usually stored at the location /etc/fstab

In the fstab file, add the following line (again, assuming that the location is “/swapfile”) to the last line and save

At this point, there should be no need to restart your system, as Linux knows to adjust using this file.

Maven Settings

So there are so many settings that get set before running a Maven build that it gets crazy.  There was a Confluence wiki that I used as part of Codehause (before they closed their doors) that I referenced a bunch when I was doing hard-core Maven plugin development that was extremely helpful.  You see, there are a bunch of ways that you can get the maven properties, but each of them requires setting up something in your project or running some odd command – but all I want is a simple reference.  So, I looked at this confluence site (which can still be found here, at least for the short term future) and compiled a list of very useful properties that everyone should have at their fingertips.  That way, whether you are setting up a project or doing plugin development, you can hit this reference.

Understanding Where The Properties Come From

First though, I’d like to cover the several ways that these properties are set.  Some are clear, some are not so much.

Maven loads up the XML files into Java Objects, and provides them for Maven plugins and the developer to use.  These XML files include pom.xml files, parent pom.xml files, as well as the settings.xml (and occasionally security-settings.xml, but I won’t cover that too much here).  The hierarchy can be a bit hard to follow for the uninitiated, but remember that all properties are resolved and then inherited (IN THAT ORDER) and the inheritance works in the way that pom.xml > parent pom.xml > settings.xml.  Or, a better way to think of it is that the most specific one wins.  Also, just in case it wasn’t clear, this is all case-sensitive, so “MyProgram” and “myprogram” are two separate variables.

When you want to access a variable, you just use the Ant model of variable replacement, which is the following: “${var_name}”.  This will evaluate the var_name and resolve it as part of your maven build.

Continue reading

Microsoft Active Directory and Cached Credentials

Microsoft has a feature that allows you to log into your computer using the Active Directory domain password.  That’s great, until you need to log in on an airplane, where you may not have internet connection back to your office.  So, Microsoft manages the cacheing of credentials.  The downside to this is if you log in from multiple computers and one day decide to change your password.  You’ll get a nice error like “The user or password is not correct.”  The problem is that there is a local user, which is cached to help you log into a disconnected environment, and the domain user, which is the global user for your company.  And if you are out of the office, you can’t communicate with Active Directory without connecting via the VPN.  So, to correct this, you do the following:

1) Log onto the system with the local/old credentials
2) Connect through VPN and verify that you have connection to the domain using your new domain password
3) Lock your system (this will force the system to reset your cache using the domain password)
4) Unlock your system, prompting you for credentials, and use your domain password to log in now

There you have it. Your login credentials are now effectively synchronized with Active Directory. (Verified with Windows XP SP3 and Windows 7).

Using HK2 with Jersey (with auto-scanning!)


HK2 has been an interesting ride. For the most part, if anyone asks, I’m still going to suggest Spring for Dependency Injection, because the documentation is a thing of wonder. Plus, Spring Inversion of Control (IoC) and Aspect Oriented Programming (AOP) are the wheelhouse that makes all of the other Spring stuff possible.  However, there are some situations where using these technologies are requested/required, so it’s good to know how to use them.

Understanding Dependency Injection

Dependency Injection is a great way to decouple your code from the implementation.  For example, if you create an interface in your core program, and you can leave the implementation for creation in a different library.  How is that useful?  One example of this would be for database access.  If you create a simple interface, like the following:

Now, use this interface in some form of implementation. This should provide a simple passthrough implementation usage of the interface:

You can then make two different implementations that function very differently, and put them in separate jars.

The first could access a database, such as PostgreSQL:

The second implementation could be a MongoDB implementation:

Now for the interesting part… You want it to be able to change at runtime. So your customer can easily change and use PostgreSQL or MongoDB with ease. Heck, they can even add a Redis store with ease and without having to recompile a single line of code. It seems like magic, but it’s not. It’s just smart decoupling.

Continue reading

The New Hotness – Spring 4’s Spring Boot

The guys who make the Spring framework libraries are no slouches.  They know the ups and downs of their own framework, as well as Java as a whole.  They are also on top of all of the newer JVM technologies, such as Groovy, Scala, Gradle, Spock, etc.  Heck, if they weren’t making money hand over fist, I’d think they would be great core language developers.  The would progress the language to a point that I’d love using it again.

The reason I say all of this is because the developers of the Spring framework realized that there are a couple other frameworks out there (Ruby on Rails, Grails, Django, etc.) that favor convention over configuration.  Meaning, I don’t want to have to set up 50 XML files to configure a project just so that I can get it running as a simple web service.  It shouldn’t be that complicated.  Spring 4 has some answers for you.  Spring introduced Spring Boot, a group of annotations that will favor convention over configuration… at least until you need to change it to something more complicated. The way it acts, I think they may have backported some of the stuff they did for Grails right into Java. Continue reading