简体   繁体   中英

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

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.

Put -vm argument above -vmargs in SpringToolSuite4.ini file

-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

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 -vm argument and the absolute path to the JDK to the SpringToolSuite4.ini file. I had the same behavior on Eclipse Photon as well, and it solved the problem there too.

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

You can read more here on this Eclipse wiki .

i faced your problem like picture

在此处输入图片说明 i copied tools.jar in my jdk1.8 to mentioned jre in the picture

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

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.

How to check:

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

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.

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.

For 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.

I fixed this issue just by following these simple steps:

  1. Go to the following option of eclipse IDE:

     Window --> Preferences --> Java --> Execution Environments
  2. Select appropriate java version jdk.

  3. Save and restart the eclipse and the error will not come.

execution_environment_java_option:

在此处输入图片说明

I had the same issue, and the only thing that solved it for me was to install the newest update of the 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.

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

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.

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.

I add the following vm argument to my eclipse.ini file and solved my problem.

-vm C:\\Program Files\\Java\\jdk1.8.0_40\\bin

You have to install jdk in your system & put this below lines above -vmargs inside SpringToolSuit.ini file

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

In my case, after setting the JAVA_HOME and path manually, doesn't fix the issue. I was seen in Eclipse , Right click on Project -> Properties -> Java Build Path -> Libraries -> Java 11 (unbound) made the error. Just edit it and point to the available version (mine is JDK 8) , which resolves the issue. 在此处输入图片说明

在此处输入图片说明

Please provide the java path and clean above the vmargs in SpringToolSuite4.ini file.

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

SpringToolSuite4.ini

 -startup
plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1200.v20200508-1552
-product
org.springframework.boot.ide.branding.sts4
--launcher.defaultAction
openFile
-clean
-vm 
C:\Program Files\Java\jdk1.8.0_271\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM

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

JDK has the 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.

将 jdk 升级到相同版本的 JRE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM