Changing classpath in Eclipse

67,574

Solution 1

Since tools.jar is an JDK library you can add it for all projects by configuring your Execution Environment. In Preferences go to Java > Installed JREs select your JDK and click on Edit.... In the new Dialog you can add external jars like tools.jar to your execution environment. I hope you have installed the JDK 1.6 and not only the JRE 1.6 as you have written in your question.

Solution 2

To change the project JRE in Eclipse, you have to go into the project specific settings (select the project folder in the Package Explorer, then go in the project and then click on properties), where you will find the Java Build Path related settings.

In the Build Path section of the project settings, you have to go into the Libraries Tab:

enter image description here

From here, you have to double click on the JRE System Library and change the execution environment to JavaSe 1.6:

JRE edit

Solution 3

Add or Edit your eclipse Classpath Variables. It is under Window > Preferences > Java > Build Path directory of eclipse.For example;

      JDK_HOME - C:/Program Files/Java/jdk1.6.0_24

Solution 4

rightclick on the project -> build path -> configure build path

...then you can change the jre for the project (from jre7 to jr6 maybe) and also remove all other libs that don't exists anymore.

Solution 5

Add your own classpath into eclipse : Project->Run/Debug Settings->Edit->Classpath

Share:
67,574
Raheel
Author by

Raheel

I am software engineer

Updated on August 30, 2020

Comments

  • Raheel
    Raheel almost 4 years

    I recently uninstalled jre7 and installed jre6, as it was required by my project. But now my program is showing an error with the classpath. How can I change the classpath in Eclipse?

    The error is:

    The archive: C:/Program Files/Java/jdk1.7.0_05/lib/tools.jar which is referenced by the classpath, does not exist.