JRE system library missing tools.jar

17,932

The issue is that the JDK contains the tools.jar file (neither of the JREs do).

It is easy to solve the problem, you have to specify the default runtime environment to use either for the project or for the whole workspace. Change that to any of the installed JDKs.

The easiest way is probably going to Window --> Preferences --> Java --> Installed JREs, and selecting the JDK instead of the JRE. All the projects use this setting by default.

Share:
17,932
Admin
Author by

Admin

Updated on June 11, 2022

Comments

  • Admin
    Admin almost 2 years

    I am using Ubuntu 12.04(LTS). In my project in Eclipse I need to use the com.sun.tools.attach package. However, my JRE system library does not include the tools.jar file which contains the package.

    I tried installing different JREs and JDKs for both Java 6 and 7. What I noticed is that some of them have the mentioned jar file in their libs folder but Eclipse still fails to include it in my classpath upon selection of the JRE. Referencing tools.jar directly solves the problem but since this is a shared project I am not allowed to modify the classpath and thus this is not a viable solution for me.

    My friend is using a MAC with the same version of Eclipse and the default JRE and does not have this problem. What we found out is that for him tools.jar is part of classes.jar which is not the case in my setup (I don't have classes.jar whatsoever).

    What do you think might be the source of this problem?