Software Ninja

The Software Ninja is a professional software developer. Here are some books I find interesting and useful.

My Photo
Name: Matt Smith
Location: Utah, United States

While continuing to provide for his family as a computer programmer, Matt has been studying marriage and relationships for many years. He is the author of the soon to be released book: Ferocious Flirting: Making Marriage Wonderful. He is also available for speaking to groups on keeping the romance going in marriage. Feel free to email me with comments, questions or suggestions.

Friday, October 26, 2007

Free XML editors

XMLSpy is the one I hear about the most, but it's only free for 30 days: http://www.altova.com/products/xmlspy/xml_editor.html

Google brings up these free ones:

Cooktop: http://www.xmlcooktop.com/
XML Notepad 2007: http://www.microsoft.com/downloads/details.aspx?familyid=72d6aa49-787d-4118-ba5f-4f30fe913628&displaylang=en

Thursday, October 18, 2007

visualvm: Introduction to VisualVM

visualvm: Introduction to VisualVM: "VisualVM is a tool that provides detailed information about Java applications while they are running. It provides an intuitive graphical user interface that allows you to easily see information about multiple Java applications. Java applications are run by a Java Virtual Machine, or VM. The name VisualVM comes from the fact that VisualVM provides VM information visually. As of October, 2007 VisualVM is still under development and is therefore considered an experimental tool. All feedback and suggestions are welcome! Please send your ideas to feedback@visualvm.dev.java.net. System Requirements The VisualVM tool itself must be run with JDK 6. It can display information, however, on any Java application that is running on JDK 1.4.2 or higher. The amount of information VisualVM can provide on a Java application is determined by the version of the JDK that is being used to run that Java application (more details below)"

Tuesday, October 16, 2007

Which class or resource is being lodaed?

I was having a problem with spring not being able to parse the applicationContext.xml. I finally checked and found out the wrong applicationContext.xml was first in the CLASSPATH.

The code to do this is easy:

System.out.println(this.getClass().getClassLoader().getResource("applicationContext.xml"));


You can also find class files. To find java.lang.Object use

System.out.println(this.getClass().getClassLoader().getResource("java/lang/Object.class"));

The result is something like:

jar:file:/C:/Program%20Files/Java/j2sdk1.4.2_14/jre/lib/rt.jar!/java/lang/Object.class

Notice how the JRE version is in the output.

Retrotranslator

Retrotranslator is a Java bytecode transformer that translates Java classes compiled with JDK 5.0 into classes that can be run on JVM 1.4. Of course there is a Maven plugin.

I needed to do some unit testing of some code that uses JavaMail. Poking around I found mock-javamail that does just that. However, it is written in Java 5 and I am stuck in the prehistoric world of Java 1.4.

At first, I converted the code to 1.4 but that leaves 2 different code bases. Then I was pointed at retrotranslator that would give a 1.4 compatible jar from 1.5 source. One code base. Nice.

Monday, October 8, 2007

Using Maven to create a one-jar executable jar.

Oliver's Blog: "Using Maven2 to generate an executable JAR"

Has instructions on getting the onejar-maven-plugin to work. This is similar to what UberJar used to to do. It takes all maven dependencies and places those jars into the output jar. It does not explode the jars as the assembly plugin is wont to do. Instead, it used the one-jar package that has a classloader that knows how to look into the jar file for other jar files. It makes for a cleaner jar file that is easier to maintain later.

It does allow the filename to be specified, but does not seem to allow manifest entries, like Implementation-Version.

Thanks Oliver.