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

14

20

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.

Gallaher answered 8/3, 2019 at 17:41 Comment(5)
What JDK are you running on? Which version? It is generally recommended to run STS on top of a JDK (not JRE) and you can configure the JDK to run the IDE itself via the eclipse.ini (or SpringToolSuite4.ini) file, as described here: wiki.eclipse.org/Eclipse.ini. Please note that newer versions of the JDK do not ship with a separate tools.jar anymore, which is file, since those classes come as part of the modules of the JDK (for JDK9 and beyond).Salema
I have installed newest Java 64-bit (since it is not working with 32-bit) and JDK. Program is actually working (probably basic functions do not require tools.jar), but i would prefer full functionality.Gallaher
hard to guess what might be going wrong here, but did you specify the JDK to run your IDE in the ini file? Feel free to post the content of your ini file to double check - or feel free to raise an issue with github.com/spring-projects/sts4/issues, so that we can troubleshoot in more detailSalema
I haven't made any configuration. When i'm searching for info i only find solutions for eclipse. I know STS is based on eclipse, but i don't want to break it even more.Gallaher
you can specify the JDK to run STS4 in the ini file in the same way that you could do this for Eclipse, but instead of modifying the eclipse.ini file, modify the SpringToolSuite4.ini file.Salema
S
27

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
Schizont answered 27/2, 2020 at 5:58 Comment(0)
K
23

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.

Koblas answered 29/5, 2019 at 11:31 Comment(1)
Just wanted to add, as mentioned in the Eclipse wiki link, the -vm option must occur after the other Eclipse-specific options (such as -product, --launcher.*, etc), but before the -vmargs option.Hydrops
C
16

i faced your problem like picture

enter image description here 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

Coenzyme answered 29/4, 2019 at 15:31 Comment(3)
The better solution would be to run Eclipse with the JDK instead of the JRE.Biramous
yes just add -vm <with jdk URI> to eclipse.ini and i will work fine tooCoenzyme
Thanks much. I followed your instructions and it solved. Thus, I upvoted your answer and the original question.Mousetail
C
5

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.

Custer answered 10/1, 2020 at 7:43 Comment(0)
S
5

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.
Selma answered 6/2, 2020 at 10:0 Comment(0)
S
3

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:

enter image description here

Schweiz answered 14/3, 2020 at 16:41 Comment(0)
S
1

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.

Shulock answered 11/9, 2019 at 7:36 Comment(0)
V
0

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
Vigilant answered 3/9, 2019 at 0:2 Comment(0)
N
0

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.

Natalianatalie answered 2/12, 2019 at 18:9 Comment(0)
C
0

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
Crews answered 3/9, 2020 at 4:19 Comment(0)
O
0

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. enter image description here

enter image description here

Operant answered 24/11, 2020 at 12:3 Comment(0)
L
0

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
Lawful answered 10/6, 2021 at 1:24 Comment(0)
P
-1

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.

Pipes answered 29/4, 2019 at 15:36 Comment(0)
N
-3

Upgrade jdk to the same version of JRE

Nobody answered 31/7, 2019 at 13:41 Comment(1)
JRE was shipped with JDK untill JDK1.8 as I know so 2 are the sameCoenzyme

© 2022 - 2024 — McMap. All rights reserved.