简体   繁体   中英

Eclipse class loading order on project runtime

I'm making some order in a very messy Java environment, and managed to build a relatively clean project (lets call it P) in Eclipse, with several jars in the classpath - to be used by the whole team. The problem is, some of these jars are a partial duplication: built externally by Ant using classes from several projects, including P. This is currently unchangeable. This means, when changes are made, built and P runs, the runtime classpath contains 2 versions of some classes.

The question is, can we count on Eclipse to take the newer class (the one from bin and not from the jar)? What's the logic of the classes loading in Eclipse runtime? I would assume the project itself comes first but I'm not sure.

I found mostly configurations for controlling plug-ins class loading policies, but even if it's applicable here, I can't tell the whole team to reconfigure their environment. Basically it's a yes-no: Can we have duplications in the classpath and be sure we run our latest changes without running a rebuild of the jars?

Go to project's build path then select Order and Export tab.

keep your src entry before (by selecting src and using up/down) that jar file's entry.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM