Using Verbose to Debug

Using Verbose to Debug

Using the -verbose option during compilation and execution is very helpful&#151both for obtaining more information about the classes being loaded by the compiler and the interpreter and to find out the point of failures in your code.

This feature is most useful when you have multiple classes with the same name set in the class path, or when you are updating code at multiple locations; using this method, you can instantly spot if some wrong class is being loaded and executed and not the one you have edited. This helps in solving problems caused due to the CLASSPATH chaos. It also helps you in figuring out exactly which class files are being used to compile your java source file.

CLASSPATH chaos occurs when you have a directory or jar file in the CLASSPATH, which happens to be before the directoryin which you are editing source. So when you try to execute the class you have just edited&#151since some other directory or jar is their already in the CLASSPATH&#151the JVM will pick up that class and execute it. Without using the -verbose, it becomes difficult to figure out which class file exactly is the JVM executing.


Share the Post: