Java 安装 Spring Tool Suite 的 JRE 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27976441/
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 05:23:49  来源:igfitidea点击:

JRE issue with getting Spring Tool Suite installed

javaspring-tool-suite

提问by Chad

I downloaded Spring Toolset 3.6 from here:

我从这里下载了 Spring Toolset 3.6:

https://spring.io/tools/sts/all

Unzipped it, launched sts.exe and got this error:

解压它,启动 sts.exe 并得到这个错误:

---------------------------
STS
---------------------------
A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run STS. No Java virtual machine
was found after searching the following locations:
D:\Setup\spring36\sts-bundle\sts-3.6.3.RELEASE\jre\bin\javaw.exe
javaw.exe in your current PATH
---------------------------
OK   
---------------------------

I have following version of (32 bit) java

我有以下版本的(32 位)java

C:\Users\Chad>java.exe -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

I tried adding the following 2 lines to the top of the STS.ini:

我尝试将以下两行添加到 STS.ini 的顶部:

-vm
C:\Windows\SysWOW64\javaw.exe

and got this error:

并收到此错误:

---------------------------
STS
---------------------------
Java was started but returned exit code=13
C:\Windows\SysWOW64\javaw.exe
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx768m
-XX:MaxPermSize=256m
-Dorg.eclipse.swt.browser.IEVersion=10001
-jar D:\Setup\spring36\sts-bundle\sts-3.6.3.RELEASE\plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
-os win32
-ws win32
-arch x86_64
-showsplash
-launcher D:\Setup\spring36\sts-bundle\sts-3.6.3.RELEASE\STS.exe
-name STS
--launcher.library D:\Setup\spring36\sts-bundle\sts-3.6.3.RELEASE\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326\eclipse_1603.dll
-startup D:\Setup\spring36\sts-bundle\sts-3.6.3.RELEASE\plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.overrideVmargs
-exitdata 1240_5c
-product org.springsource.sts.ide
-vm C:\Windows\SysWOW64\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx768m
-XX:MaxPermSize=256m
-Dorg.eclipse.swt.browser.IEVersion=10001
-jar D:\Setup\spring36\sts-bundle\sts-3.6.3.RELEASE\plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
---------------------------
OK   
---------------------------

Tried adding an Env variable:

尝试添加一个环境变量:

JAVA_HOME = C:\Windows\SysWOW64\

...same error

...同样的错误

when I opened up the Java Control panel, I saw that the active version, 1.7 pointed to this path:

当我打开 Java 控制面板时,我看到活动版本 1.7 指向这个路径:

C:\Program Files (x86)\Java\jre7\bin\javaw.exe

I also tried adding the following to my PATH variable

我还尝试将以下内容添加到我的 PATH 变量中

C:\Program Files (x86)\Java\jre7\bin

C:\Program Files (x86)\Java\jre7\bin

...no change,

...没变,

When I noticed the following line in one of the error messages above:

当我在上述错误消息之一中注意到以下行时:

Dosgi.requiredJavaVersion=1.6

I tried switching the active version of java (the one checked inh the control panel) to the 1.65 version and I changed all of the above paths to point to reference it.

我尝试将 java 的活动版本(在控制面板中检查的那个版本)切换到 1.65 版本,并且我更改了上述所有路径以指向引用它。

C:\Program Files (x86)\Java\jre6\bin\javaw.exe

I'm sure I didn't try all permutations, but I am obviously gasping at straws.

我敢肯定我没有尝试过所有的排列,但我显然在吸管中喘不过气来。

I also tried downloading the 32 bit JDK because I saw something about maybe needing that.

我还尝试下载 32 位 JDK,因为我看到可能需要它。

Is this some sort of a 32/64 bit mix up? The STS zip file was named indicating a 32 bit version, although at work on my laptop I somewhere found a version that had both 32 and 64 in the name of the zip. I only saw one version of the app in the zip file. How can one app be both 32 and 64 bit at the same time?

这是某种 32/64 位混淆吗?STS zip 文件被命名为 32 位版本,尽管在我的笔记本电脑上工作时,我在某处发现了一个 zip 名称中同时包含 32 和 64 的版本。我只在 zip 文件中看到了该应用程序的一个版本。一个应用程序如何同时是 32 位和 64 位?

spring-tool-suite-3.6.3.RELEASE-e4.4.1-win32.zip

spring-tool-suite-3.6.3.RELEASE-e4.4.1-win32.zip

This is my first attempt to try anything using Java and I'm frustrated just starting...

这是我第一次尝试使用 Java 尝试任何东西,刚开始我很沮丧......

采纳答案by aboyko

Your STS/Eclipse is x64 bit I think due to this line "-arch x86_64" in your STS startup error. You'd need to specify -vm argument in STS.ini. For example: -vm C:\Java\JDK\1.6\bin\javaw.exe

您的 STS/Eclipse 是 x64 位,我认为是由于 STS 启动错误中的这一行“-arch x86_64”。您需要在 STS.ini 中指定 -vm 参数。例如:-vm C:\Java\JDK\1.6\bin\javaw.exe

The folder you've specified C:\Windows\SysWOW64\javaw.exe... is it pointing to the right x64 VM? The JDK/JRE folder must have bin, lib and other sub-folders. The javaw.exe that you point to must be in the "bin" folder. I don't see the "bin" in your VM path. Keep the file structure of the JDK/JRE folder unchanged.

您指定的文件夹 C:\Windows\SysWOW64\javaw.exe ... 是否指向正确的 x64 VM?JDK/JRE 文件夹必须有 bin、lib 等子文件夹。您指向的 javaw.exe 必须位于“bin”文件夹中。我在您的 VM 路径中没有看到“bin”。保持 JDK/JRE 文件夹的文件结构不变。

回答by Jamie Weston

My problem was slightly different in that STS originally worked correctly for some time, and then failed to work on the next launch.

我的问题略有不同,因为 STS 最初可以正常工作一段时间,然后在下一次发布时无法工作。

Following the suggestions in the error message (that 'No Java virtual machine was found after searching the following locations: ...\sts-bundle\sts-3.6.3.RELEASE\jre\bin\javaw.exe in your current PATH'), I was able to identify that the entire \jre was missing.

按照错误消息中的建议(即“在您当前的路径中搜索以下位置后未找到 Java 虚拟机:...\sts-bundle\sts-3.6.3.RELEASE\jre\bin\javaw.exe” ),我能够确定整个 \jre 丢失了。

Reinstalling JRE 1.7 with default settings, and copying the files from C:\Program Files\Java to my STS installation resolved the issue.

使用默认设置重新安装 JRE 1.7,并将文件从 C:\Program Files\Java 复制到我的 STS 安装解决了该问题。

回答by Leroy

Go to your installed JRE folder (\Program Files\Java\jre [any version installed]\bin) then look for javaw.exe. Copy that application to your spring folder.

转到已安装的 JRE 文件夹(\Program Files\Java\jre [已安装的任何版本]\bin),然后查找javaw.exe. 将该应用程序复制到您的 spring 文件夹中。

回答by Francisco Acevedo

I had this problem with STS4. Solved it adding -vm parameter in SpringToolSuite4.ini:

我在使用 STS4 时遇到了这个问题。解决了在SpringToolSuite4.ini中添加-vm参数的问题:

-startup
plugins/org.eclipse.equinox.launcher_1.5.100.v20180827-1352.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.800.v20180827-1352
-product
org.springframework.boot.ide.branding.sts4
--launcher.defaultAction
openFile
-vm
C:\Program Files\Java\jdk1.8.0_162\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
--add-modules=ALL-SYSTEM
-Xms40m
-Xmx1200m

IMPORTANT: this didn't work when I added the config parameter at the end of the file, it had to be in the middle between openFileand -vmargslines.

重要提示:当我在文件末尾添加 config 参数时,这不起作用,它必须位于openFile-vmargs行之间。

For deeper details about STS/Eclipse INI configuration check Missing tools.jar when launching STS applicationand eclipse.ini

有关 STS/Eclipse INI 配置的更详细信息,请检查启动 STS 应用程序eclipse.ini时缺少的 tools.jar

回答by rbelow

Linux

Linux

This solution works with:

此解决方案适用于:

Ubuntu 18.04.1 LTS

Spring Tool Suite 4 
Version: 4.1.1.RELEASE
Build Id: 201901241133
OS: Linux, v.4.15.0-45-generic, x86_64 / gtk 3.22.30
Java version: 11.0.2

In your Spring Tool Suite root folderadd to the file SprintToolSuite4.inifollowing 2 lines after openFile:

在您的Spring Tool Suite 根文件夹中,将以下 2 行添加到文件SprintToolSuite4.ini 中openFile

-vm
/usr/lib/jvm/<your-java-folder>/<your-java-subfolder>/bin

Your SprintToolSuite4.inifile should look now something like this:

您的SprintToolSuite4.ini文件现在应如下所示:

enter image description here

在此处输入图片说明



Other OSs

其他操作系统

Add the right path to your JRE (the java/binfolder) to your inifile.

将 JRE(java/bin文件夹)的正确路径添加到您的ini文件中。

回答by Sumanth Varada

I have faced this issue multiple times. Please do following checks in order to rectify the above issue.

我多次遇到过这个问题。请进行以下检查以纠正上述问题。

  1. Check your environment variables for Java. Some times even if the environment variables setup properly, it doesn't identify when you are trying to java -versionin command prompt.
  2. if it is eclipse/ STS then open eclipse.ini or sts.ini configuration file and setup your run-time environment in the following way.
  1. 检查 Java 的环境变量。有时即使环境变量设置正确,它也无法识别您何时在命令提示符中尝试java -version
  2. 如果是 eclipse/STS 则打开 eclipse.ini 或 sts.ini 配置文件并按照以下方式设置您的运行时环境。

Below open file just add the following two lines and save it and restart your eclipse/STS.

在打开的文件下面,只需添加以下两行并保存并重新启动您的 eclipse/STS。

-vm
C:\Program Files\Oracle\OpenJDK 11.0.1\bin

回答by Mamed Yahyayev

I solve this issue with the following steps:

我通过以下步骤解决了这个问题:

  1. create a jrefolder in sts-4.6.1.RELEASE

  2. create binfolder in jre folder

  3. copy javaw.exeand paste to the bin folder

  1. 在 sts-4.6.1.RELEASE 中创建一个jre文件夹

  2. 在 jre 文件夹中创建bin文件夹

  3. 复制javaw.exe并粘贴到 bin 文件夹