Reputation: 12897
I have a java project which uses apache poi jars.
In eclipse referenced libraries two versions of poi jar is available. poi3.5 and poi3.7.
In java code im using
import org.apache.poi.hssf.usermodel.HSSFRow;
In eclipse how to know which version of the jar file it will refer. IF there are two versions of same jar file available in class path, which one will it take?
Edit:-
In eclipse i had seen someone using a keyboard shortcut over that import statements to show the correct jar. Any one knows what that shortcut is?
Upvotes: 1
Views: 7517
Reputation: 11
I think you are looking for shortcut ctrl+shift+t Select import statement & use above shortcut.
Upvotes: 1
Reputation: 9293
Jars are examined in the order they appear in the classpath. In Eclipse you have the "Java Build Path" dialog that contains the "Order and Export" tab: there you can read/modify the order of the libraries.
To access directly a class in the right Jar just press CTRL and click on the class name.
Of course, having two different versions of the same Jar is a configuration bug: you should remove one of them. Also consider that the order you have in Eclipse could be different from the order in another execution environment (for example an application server).
Upvotes: 0
Reputation: 2132
It takes the first library that you added to build pass.Other same packages from another libraries will be ignoring
Upvotes: 0