1

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?

Andromeda
  • 12,659
  • 20
  • 77
  • 103
  • 1
    http://stackoverflow.com/questions/6105124/java-classpath-classloading-multiple-versions-of-the-same-jar-project – kosa Sep 13 '12 at 06:17
  • Are you looking for import statement to import automatically exact packages for a class? – thar45 Sep 13 '12 at 07:34

3 Answers3

1

I think you are looking for shortcut ctrl+shift+t Select import statement & use above shortcut.

0

It takes the first library that you added to build pass.Other same packages from another libraries will be ignoring

Yahor10
  • 2,123
  • 1
  • 13
  • 13
0

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).

Pino
  • 7,468
  • 6
  • 50
  • 69