spring tools suite配置jre 11虚拟机

540 阅读1分钟

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运行环境。

参考

eclipse.ini -Specifying the JVM

Spring Tool Suite 3.9.13 - Set SDK

Upstream | AdoptOpenJDK - Open source, prebuilt OpenJDK binaries