My Eclipse is Indigo Java classic.
I have a java project which has mockito-all as a dependency. pom.xml:
org.mo
Go to Window > Show View > Navigator
There you will see .classpath
file where the dependencies related to your M2 Repo can be seen
An example would be -
<classpathentry
exported="true"
kind="var"
path="M2_REPO/javax/activation/activation/1.1.1-redhat-2/activation-1.1.1-redhat-2.jar"/>
Change the version to the one under
Project Explorer > Your Project > Libraraies > Maven Dependencies
Hopefully this will resolve the issue.
I had a similar problem while I was trying to start my tomcat. I would suggest that you check "Classpath" the following way:
1) Run Configurations
2) Project classpath
In my case I had a JRE installed then added a JDK. ANT seemed to stick with the JRE even though I changed my project to use the JDK.
To fix this I had to do: 1. Select "Run As..." 2. Select the second "Ant build..." option 3. This brings up a panel to allow setting configuration. Choose the "JRE" tab and change the selected JRE to the JDK
It might be the version issue of java and eclipse.
I upgraded from kepler to mars and I was using JAVA 1.7. I faced the same issue with tools.jar.
I downgrade the eclipse and this time build ran successfully. It might help you.
If any of the previous answers didn't work, try this : Right click on your project -> Debug As -> Open Debug Dialog ... -> In the classpath you'll find the jar causing you the trouble. Remove it.
Hope this work for you as it worked for me.
In my case with using ANT I change the setting in Windows --> Preferences --> Ant --> Runtime --> Global Entries. You need to add tools.jar as an External Jar.