My thoughts as an enterprise Java developer.

Friday, August 12, 2005

Finding the file for a class


Classpath Problems
Another class of problems are classpath issues. There are times when you are not sure if there is another version of a class in the classpath that is getting picked up before yours, usually a result of a bad environment setup. To eliminate this possibility, a simple check is to add a print statement to see if your new code gets picked up. If it isn't getting picked up, you need to locate the other class that is getting picked up. One neat API in Java that allows you to locate where a class is being picked up is:


In most cases, depending on the class loader being used, you'll get the location of the class that is being executed and you can correct your environment setup.

No comments: