Saturday, December 08, 2007

I Love Libraries

I think one of my favorite things about going to work for IBM is my access to the library we have here in Austin. I love to read (online and off line) about technology and I'm always trying to hone my skills and pick up new skills and tricks. So far, I've read Practices of an Agile Developer, which is great by the way, and I'm reading Practical Development Environments right now. Before I started working, I had to scrounge whatever books I could find, but now I have more access and I can't wait to read more. I already have about eight other books I plan on reading as well as another seven or so useful references such as the awesome Bash Cookbook from O'Reilly. It has been incredibly helpful in helping me improve my skills with Bash. Once I get further along in reading Practical Development Environments, I'll put up my thoughts on the book. So far it has been a very interesting and fun read.

Friday, December 07, 2007

Fun with javap

I finally was able to try out javap for the first time today. I needed to know what version of Java a class file was compiled in and javap came to the rescue! To determine the version simply run javap on the class.

javap -verbose my/compiled/class

This will dump a bunch of information about your class file. The only thing you are looking for is the major version up at the top. It should look something like this.
$ javap -verbose aTest/service/EJBHelloService
Compiled from ""
public class aTest.service.EJBHelloService extends
SourceFile: ""
RuntimeVisibleAnnotations: length = 0x15
00 01 00 24 00 03 00 1C 73 00 25 00 26 73 00 27
00 28 73 00 29
minor version: 0
major version: 50
Constant pool:
const #1 = Method #16.#42; // javax/xml/ws/Service."":(Ljava/net/URL;Ljavax/xml/namespace/QName;)V
const #2 = Field #15.#43; // aTest/service/EJBHelloService.EJBHELLOSERVICE_WSDL_LOCATION:Ljava/net/URL;
const #3 = class #44; // javax/xml/namespace/QName
const #4 = String #39; // http://service.aTest/
The versions of Java go like this:

Java 6 50
Java 5 49
Java 1.4.2
Java 1.3.1
etc ...