Two classes with same name in classpath

后端 未结 4 462
醉话见心
醉话见心 2020-12-29 11:18

If I have two classes with same name say Matcher.java in two different jar in my classpath which one will be picked up by JVM , is there anyway I can suggest JVM to pick a s

4条回答
  •  伪装坚强ぢ
    2020-12-29 11:42

    The first one found in the classpath. ie, the first jar containing your class will be used.

    You can't control it from within the JVM, but you can control the classpath - make sure the one you want is listed/found first in the classpath.

提交回复
热议问题