Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find a duplicate class on the class path?

How do I find a duplicate class on the class path?

Background:

I suspect to have a duplicate class (javax.mail.Session). I found one jar with this class, but I have no idea where the second jar containing the same class is.

I am using Eclipse.

like image 796
stefan bachert Avatar asked Jul 20 '12 09:07

stefan bachert


People also ask

How do I get all classes in a classpath?

You can get all classpath roots by passing an empty String into ClassLoader#getResources() . Enumeration<URL> roots = classLoader. getResources("");

What is duplicate class in Java?

The "duplicate class" error can also occur when the class is named the same with the same package naming hierarchy, even if one of the classes exists in a directory structure with directory names different than the package names. This is shown in the next screen snapshot.


1 Answers

In eclipse press ctrl-shift-T and type Session:

eclipse screenshot

like image 114
matt burns Avatar answered Sep 21 '22 19:09

matt burns