Loading

Spring Tools Suite配置JDK 11虚拟机

sts-3.9.16(spring tool suite)需要运行环境jre 11运行,所以研究了下怎么配置指定的虚拟机。没有采用直接配置系统环境变量解决。

STS.ini配置vm参数

# https://docs.spring.io/sts/nan/v3913/NewAndNoteworthy.html
# https://wiki.eclipse.org/Eclipse.ini
# 添加虚拟机路径,一定要在第一行
-vm
D:\Program Files\openjdk-11.0.10_9\bin\javaw.exe

-startup
plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.100.v20210209-1541
-product
org.springsource.sts.ide
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-Dosgi.module.lock.timeout=10

本来看了eclipse.ini -Specifying the JVM 的说法,认为配置下就行了,结果还是有坑,首先vm参数一定要在vmargs之前,这个就无需多讲。官方提到STS.ini文件中,必须把vm配置到第一行,在所有的其它组件加载之前设置,不然依然出现找不到匹配的jre运行环境。

Spring Tools Suite 3.9.16 eclipse插件安装失败

尝试在3.9.16上安装eclipse插件,sts按照上述配置了JDK 11,安装插件时出现错误:

Cannot complete the install because some dependencies are not satisfiable
  Software being installed: a.jre.javase 9.0.0
  Software currently installed: Spring Tool Suite 3.9.16.202103111951-RELEASE-e419 (org.springsource.sts.ide 3.9.16.202103111951-RELEASE-e419)
  Cannot satisfy dependency:
    From: Spring Tool Suite 3.9.16.202103111951-RELEASE-e419 (org.springsource.sts.ide 3.9.16.202103111951-RELEASE-e419)
    To: org.eclipse.equinox.p2.iu; a.jre.javase [9.0.0,9.0.0]

Eclipse插件需要JRE 9的运行环境,但是sts需要JRE 11,造成了不满足依赖一直不能安装插件。
解决方案:把STS退回到支持JDK 9/JDK 10/JDK 11的版本,从STS 3.9.1开始需要JDK 9,
STS 3.9.0支持JDK 8(应该是最后一个支持JDK 8的版本了)

Deepin OS 深度系统(Linux)上的sts.ini的位置在/opt/apps/com.io.spring-tool-suite/files/spring-tool-suite/SpringToolSuite4.ini

Spring Tools Suite 3.9.10最后一个支持JDK 8

如果还在使用JDK 1.8不想配置JDK 11,则可以使用Spring Tools Suite 3.9.10这个版本,因为从3.9.10开始必须使用JDK 9才能运行。

参考

eclipse.ini -Specifying the JVM

Spring Tool Suite 3.9.13 - Set SDK

Upstream | AdoptOpenJDK - Open source, prebuilt OpenJDK binaries

Spring Tool Suite release distribution

posted @ 2021-09-24 08:34  betgar  阅读(664)  评论(0)    收藏  举报