Java 在活动的 JRE 中找不到 tools.jar - Spring Tools Suite

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/55068342/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 01:10:25  来源:igfitidea点击:

Could not find tools.jar in the active JRE - Spring Tools Suite

javaspring-tool-suitetools.jar

提问by

I know there are multiple topics about that, but none of it is about Spring Tools Suite. And i'm finding informations that this file no longer exists in newer Java versions, which seems to be true, since i cannot find it. I'm absolutely lost now.

我知道有很多关于这个的主题,但没有一个是关于 Spring Tools Suite 的。而且我发现这个文件在较新的 Java 版本中不再存在的信息,这似乎是真的,因为我找不到它。我现在完全迷失了。

回答by fathy elshemy

i faced your problem like picture

我遇到了你的问题,如图片

enter image description herei copied tools.jar in my jdk1.8 to mentioned jre in the picture

在此处输入图片说明我将jdk1.8中的tools.jar复制到图片中提到的jre

C:\Program Files\Java\jdk1.8.0_191\lib\tools.jar 
to 
C:\Program Files\Java\jre1.8.0_211\lib

then working fine to me and error disappeared note i use - JDK1.8.0_191 - jre1.8.0_211 and i think it will working fine to u

然后对我来说工作正常并且错误消失了我使用的注释 - JDK1.8.0_191 - jre1.8.0_211,我认为它对你来说可以正常工作

回答by gonzaloan

You need to work with the JDK instead of the JRE.

您需要使用 JDK 而不是 JRE。

JDK has the tools.jar,

JDK有tools.jar,

If you want to work with the JRE, you can download the JDK and add the Jars that you need into the classpath.

如果您想使用 JRE,您可以下载 JDK 并将您需要的 Jars 添加到类路径中。

回答by Akabelle

No matter how many times did I change the JRE to JDK, updated paths and system variables, in the end my problem was solved by adding the -vmargument and the absolute pathto the JDK to the SpringToolSuite4.inifile. I had the same behavior on Eclipse Photon as well, and it solved the problem there too.

无论我将JRE更改为JDK多少次,更新了路径和系统变量,最终通过在SpringToolSuite4.ini文件中添加-vm参数和JDK的绝对路径解决了我的问题。我在 Eclipse Photon 上也有同样的行为,它也解决了那里的问题。

-vm
C:\Program Files\Java\jdk1.8.0_181\bin\javaw.exe

You can read more here on this Eclipse wiki.

您可以在此 Eclipse wiki上阅读更多内容。

回答by VTRN

Upgrade jdk to the same version of JRE

将 jdk 升级到相同版本的 JRE

回答by ricardobelo

I fixed it like this:

我是这样修复的:

user@mynode:~$ echo $JAVA_HOME/lib
/usr/lib/jvm/java-8-oracle/lib

user@mynode:~$ sudo ln -s $JAVA_HOME/lib /usr/lib/jvm/java-ibm-x86_64-80/lib

回答by Dikla

I had the same issue, and the only thing that solved it for me was to install the newest update of the JDK.

我遇到了同样的问题,唯一为我解决的就是安装最新的 JDK 更新。

I had a windows update that probably installed a Java update. Apparently, Eclipse is using the Java that was installed the most recently (it takes it from Windows/System32 - see here). Manually installing a JDK update after the automatically installed JRE solved the problem.

我有一个可能安装了 Java 更新的 Windows 更新。显然,Eclipse 使用的是最近安装的 Java(它从 Windows/System32 中获取 - 请参见此处)。自动安装JRE后手动安装JDK更新解决了问题。

回答by Dotard

Started seeing this error after trying to use Java 11 for my Spring Boot project by setting Installed JREs and Compiler preferences to Java 11.

通过将已安装的 JRE 和编译器首选项设置为 Java 11,尝试将 Java 11 用于我的 Spring Boot 项目后开始看到此错误。

Adding the -vm argument in eclipse.ini or SpringToolSuite4.ini did not help in my case. Had to switch the JDK on Windows Path environment variable to get past this error (path was poining to Java 8 earlier). Also made -Dosgi.requiredJavaVersion=11 on the .ini file.

在 eclipse.ini 或 SpringToolSuite4.ini 中添加 -vm 参数在我的情况下没有帮助。必须在 Windows Path 环境变量上切换 JDK 才能克服此错误(路径之前指向 Java 8)。还在 .ini 文件上制作了 -Dosgi.requiredJavaVersion=11。

回答by Michael S

I could solve it by fixing the PATH. I had a jre and a jdk installed on my Windows.JAVA_HOME was correctly set to the jdk, but the jre was first in the path. I fixed my path by moving the jdk before the jre and then the problem was gone.

我可以通过修复PATH来解决它。我有一个 jre 和一个 jdk 安装在我的 Windows.JAVA_HOME 正确设置为 jdk,但 jre 是路径中的第一个。我通过在 jre 之前移动 jdk 来修复我的路径,然后问题就消失了。

How to check:

如何检查:

Open Windows cmd window. Then execute where java. You'll see something like this:

打开 Windows cmd 窗口。然后执行where java。你会看到这样的东西:

C:\Users\d058029>where java
C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe
C:\Program Files\Standalone\jdk1.8.0_172\bin\java.exe

Here you see. jre is first. Use Windows control panel -> Edit the system environment variables and make sure jdk comes before jre.

给你看。jre是第一位的。使用 Windows 控制面板 -> 编辑系统环境变量并确保 jdk 在 jre 之前。

回答by M. Franklin

I fixed this by adding the JDK to the Path in the system environment variables and moving it to the top/first in the list. The only path to Java that was previously in the PATH was C:\Program Files (x86)\Common Files\Oracle\Java\javapath. I needed to add C:\Program Files\Java\jdk1.8.0_211\bin to the Path and move it to the top.

我通过将 JDK 添加到系统环境变量中的 Path 并将其移动到列表中的顶部/第一个来解决此问题。以前在 PATH 中的 Java 的唯一路径是 C:\Program Files (x86)\Common Files\Oracle\Java\javapath。我需要将 C:\Program Files\Java\jdk1.8.0_211\bin 添加到 Path 并将其移动到顶部。

For Windows:

对于 Windows:

  1. In Windows Explorer, go to Control Panel\System and Security\System
  2. Click on "Advanced System Settings"
  3. Go to the Advanced tab and click on Environment Variables
  4. Under System Variables, edit the Path.
  5. Add the bin directory of your JDK, such as C:\Program Files\Java\jdk1.8.0_211\bin, to the path and move it to the top.
  6. Click OK, OK.
  7. Restart Spring Tool Suite.
  1. 在 Windows 资源管理器中,转到控制面板\系统和安全\系统
  2. 点击“高级系统设置”
  3. 转到高级选项卡,然后单击环境变量
  4. 在系统变量下,编辑路径。
  5. 将你的 JDK 的 bin 目录,例如 C:\Program Files\Java\jdk1.8.0_211\bin 添加到路径中并将其移动到顶部。
  6. 单击确定,确定。
  7. 重新启动 Spring 工具套件。

回答by MayankNC

Put -vmargument above-vmargsin SpringToolSuite4.inifile

-vm参数上面-vmargsSpringToolSuite4.ini文件

-startup
plugins/org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1100.v20190907-0426
-product
org.springframework.boot.ide.branding.sts4
--launcher.defaultAction
openFile
-vm
C:\Program Files\Java\jdk1.8.0_181\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM