Wednesday, May 6, 2009

Easy way of testing class files

If code base is large and takes time to build, we can do the following to quickly test our fix.

1. Build class files in the sub directory where you made code change.

2. Prepare a jar file in the following format:
* Suppose package name is com.sun.identity.authentication for your class file, then create folder structure ~/ws/com/sun/identity/authentication in your workspace. Copy newly built class file into com/sun/identity/authentication. Do jar -cvf ~/test.jar * in your workspace ~/ws.

3. Place the complete path of this jar file like /home/lakshman/test.jar as first entry in classpath of your webserver server.xml file or app server domain.xml

4. Restart container.

Your fix will kick in and you can test your fix.