17

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.

  • 2
    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: https://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). – Martin Lippert Mar 11 '19 at 10:48
  • 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. –  Mar 13 '19 at 13:39
  • 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 https://github.com/spring-projects/sts4/issues, so that we can troubleshoot in more detail – Martin Lippert Mar 14 '19 at 14:24
  • 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. –  Mar 15 '19 at 18:23
  • 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. – Martin Lippert Mar 17 '19 at 10:58

14 Answers14

24

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
MayankNC
  • 341
  • 2
  • 5
22

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.

Akabelle
  • 388
  • 6
  • 12
  • 6
    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. – Rich Tillis Sep 25 '19 at 17:09
15

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

fathy elshemy
  • 446
  • 3
  • 12
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.

Michael S
  • 456
  • 5
  • 12
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.
M. Franklin
  • 61
  • 1
  • 2
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

Wai Ha Lee
  • 7,664
  • 52
  • 54
  • 80
shuzzzam
  • 31
  • 1
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.

Dikla
  • 3,253
  • 5
  • 27
  • 41
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
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.

Dotard
  • 21
  • 2
0

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

Ali Yeganeh
  • 557
  • 8
  • 13
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
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

VNT
  • 654
  • 2
  • 6
  • 18
-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.

gonzaloan
  • 361
  • 2
  • 13
-3

Upgrade jdk to the same version of JRE

RobC
  • 16,905
  • 14
  • 51
  • 62
VTRN
  • 1