Monday, January 14, 2019

java: Method not found exception


Even after adding right dependencies to classpath, we may get method not found exception. It is hard to find out the conflicting class file in jars. Use below unix command to find out the jar files which has same class file.
Below command finds Hello.class in jar files.

 find . -type f -name '*.jar' -print0 |  xargs -0 -I '{}' sh -c 'jar tf {} | grep Hello.class &&  echo {}'

No comments: