JRE system library missing tools.jar

前端 未结 2 1127
走了就别回头了
走了就别回头了 2021-01-05 12:12

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 whi

相关标签:
2条回答
  • 2021-01-05 12:22

    I had exactly the same problem on Ubuntu 12.10 and in my case managed to solve it by adding a reference to the current Java binaries folder to my PATH variable.

    PATH="$PATH:/usr/local/java/current/bin"
    

    Or

    PATH="$PATH:$JAVA_HOME/bin"
    

    Just edit either .profile or .bash_profile in your /home/<user> folder and you should be fine. If these files doesn't exist just create one of them.

    Note: make sure your are using JDK and not JRE

    0 讨论(0)
  • 2021-01-05 12:43

    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.

    0 讨论(0)
提交回复
热议问题