Posts Tagged ‘tip’

Using a Maven profile to run a test program

Tuesday, August 25th, 2009

This is a new (to me) trick for my programming toolbox. I discovered (copied) it from the Apache CXF project. (I don’t know if they originated it or not.) Basically, you can use a Maven profile configuration in your pom.xml to easily run a test program in your project that has a public static void main(String[] args) method. I discovered this technique reading the README.txt of the Apache CXF sample “java_first_jaxws“. Here is what the Maven command looks like:

mvn -Pserver

Here is what the profile configuration in the pom.xml looks like:


When the “mvn -Pserver” command is executed, the exec-maven-plugin will run the demo.hw.server.Server class. The id identifies the profile id used in the mvn command after the “-p“. The mainClass element defines the class with the main method to execute. The exec-maven-plugin does all of the hard work. One of the benefits of this technique is the standard Maven classpath for the project defined in the pom to build and unit test your software is used to run the mainClass. This comes in quite handy if your program uses many jar files. I used to use a Windows batch file (copied from the Tomcat startup script catalina.bat) to run little test programs. This Maven profile technique is much easier to use for me, since I use Maven for most all of my Java development.

Remote desktop connection tip

Wednesday, March 18th, 2009

Today I am working from home because Sydney is sick. I therefore connect via the VPN to my work computer. I use Microsoft Remote Desktop Connection to connect to my work computer. But periodically I have problems typing into the remote computer: whenever I type a ‘u’ character, the Microsoft Utility Manager pops up.

After doing a bit of searching on Google, I came upon this post “Windows key “stuck” in Remote Desktop…“. This seemed to accurately describe my problem. But, the first comment in the post was able to work around my particular problem:

The best workaround that always works for me is:

1. Close the RD window
2. Open new RD but make sure the “Apply Windows key Combinations” is set to “On the remote computer”
3. Now press the Ctrl+Alt+End and lock the computer
4. Log in again and it should work.


I put this here so that I can remember it for the next time. (Yeah, I pretty much expect that this condition will happen again.)