SDKMAN!不适用于Eclipse.app或SpringToolSuite4.app(在Mac上) [英] SDKMAN! does not work with Eclipse.app or SpringToolSuite4.app (on Mac)
问题描述
这与以下问题类似: Eclipse找不到使用sdkman安装的jdk
This is a similar issue to: Eclipse can't find jdk installed with sdkman
在Mac(macos-mojave
)上我仍然面临问题
I am still facing the issue on Mac (macos-mojave
)
我两个人
/usr/bin/java
/usr/bin/javac
指向
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac
分别.
SDKMAN!确实为SDKMAN!的默认Java版本安装了正确的java
和javac
.
SDKMAN! does install the proper java
and javac
for the SDKMAN!'s default Java version.
因此,我确实有正确的java
和javac
:
Thus, I do have proper java
and javac
:
% java -version
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.3+7, mixed mode)
% javac -version
javac 11.0.3
但是,我没有安装任何Java版本:
However, I do not have any Java versions installed in:
ls -la /Library/Java/JavaVirtualMachines
total 0
drwxr-xr-x 2 root wheel 64 Jun 19 10:06 .
drwxr-xr-x 4 root wheel 128 Apr 16 06:16 ..
我还尝试更新/Applications/SpringToolSuite4.app/Contents/Eclipse/SpringToolSuite4.ini
中的JVM参考(与Eclipse.ini
相比):
I also tried updating the JVM reference in /Applications/SpringToolSuite4.app/Contents/Eclipse/SpringToolSuite4.ini
(comparable to Eclipse.ini
):
-vm
/Users/johndoe/.sdkman/candidates/java/current/bin/java
-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.5.300.v20190213-1655.jar
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.1000.v20190125-2016
-product
org.springframework.boot.ide.branding.sts4
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Xdock:icon=../Resources/sts4.icns
我确实获得了STS的初始屏幕,但是它仍然报告未安装JVM(请参见屏幕截图)
I do get a splash screen for STS, but it still reports no JVMs installed (see screenshots)
似乎Eclipse.app
和SpringToolSuite4.app
都需要传统上安装正确的JDK,而不使用SDKMAN!
And it seems both Eclipse.app
and SpringToolSuite4.app
require proper JDK installed traditionally, not using SDKMAN!
我真的不想安装除SDKMAN之外的其他JDK!
I really don't want to install another JDK besides SDKMAN!
有人让它起作用吗?
谢谢!
推荐答案
如果Eclipse启动器找不到合适的JVM来运行(我假设这是这里的问题),通常可以通过指向"eclipse.ini"(或视情况而定为"STS.ini")添加到您选择的JVM.
If the Eclipse launcher cannot find a suitable JVM to run on (which I am assuming is the problem here), you can usually work around this by pointing the 'eclipse.ini' (or 'STS.ini' as the case may be) to the JVM of your choice.
为此,请在文本编辑器中打开.ini
文件,并在文件的前面添加两行.像这样:
To do this, open the .ini
file in a text editor and add two lines at the front of the file. Something like this:
-vm
/usr/lib/jvm/jdk-1.8.0/bin/java
... the rest of the file unchanged...
请注意,重要的是
1)这些行是文件中的第一行
1) these lines are the very first in the file
2)它们位于两行中(不要尝试将-vm
和jvm可执行文件的路径放在同一行中,这是行不通的.)
2) they are on two separate lines (don't try to put both -vm
and path of the jvm executable on a single line, it doesn't work).
这篇关于SDKMAN!不适用于Eclipse.app或SpringToolSuite4.app(在Mac上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!