Java 当路径包含空格时,如何在 Windows 8 上的 eclipse.ini 中指定 jdk 路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23174265/
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
How to specify jdk path in eclipse.ini on windows 8 when path contains space
提问by user310291
This doesn't work -vm %JAVA_HOME%/bin/javaw.exe
这不起作用 -vm %JAVA_HOME%/bin/javaw.exe
How can I replace %JAVA_HOME% with full path on windows 8 when path contains space ("program files" directory)
当路径包含空格(“程序文件”目录)时,如何在 Windows 8 上用完整路径替换 %JAVA_HOME%
采纳答案by Braj
Have you tried it. Don't put everything in single line.
你有没有试过。不要将所有内容都放在一行中。
-vm
C:\Program Files\Java\jdk1.6.0_07\bin\
Need to put the folder that contains the javaw or java executable. Under Ubuntu 18 with eclipse 4.7.1 I was able to get it to run with:
需要放置包含 javaw 或 java 可执行文件的文件夹。在带有 Eclipse 4.7.1 的 Ubuntu 18 下,我能够让它运行:
-vm
/usr/lib/jvm/java-8-openjdk-amd64/bin
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.500.v20170531-1133
-vmargs
-Xmx2G
-Xms200m
-XX:MaxPermSize=384m
If it doesn't work then please confirm you have added above lines before -vmargs
in eclipse.ini
.
如果它不起作用,请确认您-vmargs
在eclipse.ini
.
回答by BlackPOP
Try to escape the space with back slash.. Like
尝试用反斜杠逃离空间.. 喜欢
C:\program\folder\ \name\java\jdk\bin
C:\program\folder\\name\java\jdk\bin
回答by Sagar Chaudhari
-vm C:\Program Files\Java\jdk1.6.0_07\bin\javaw.exe
-vm C:\Program Files\Java\jdk1.6.0_07\bin\javaw.exe
回答by Joe
Reinstall java and choose a destination folder without a space
重新安装java并选择一个没有空格的目标文件夹
回答by Sreedhar GS
Add the entry of vm above the vm args else it will not work..! i.e `
在 vm args 上方添加 vm 条目,否则它将不起作用..!即`
-vm C:\Program Files\Java\jdk1.7.0_75\bin\javaw.exe --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m
回答by Robert
Windows-vm "C:\Program Files\Java\jdk1.6.0_07\jre\bin\javaw.exe"
Windows-vm "C:\Program Files\Java\jdk1.6.0_07\ jre\bin\javaw.exe"
回答by derloopkat
I have Windows 8.1 and my JDK under "Program Files" as well. What worked for me was replacing the name of the folder by the 8-digit internal MS-DOS name.
我在“程序文件”下也有 Windows 8.1 和我的 JDK。对我有用的是用 8 位内部 MS-DOS 名称替换文件夹的名称。
-vm
C:/PROGRA~1/Java/jdk1.8.0_40/bin/javaw.exe
I realized what was going on after running this in cmd.exe
在 cmd.exe 中运行此命令后,我意识到发生了什么
CD \
DIR P* /X
It returned...
它回来了……
<DIR> PROGRA~1 Program Files
<DIR> PROGRA~2 Program Files (x86)
So we can find out how to use a path containing spaces
所以我们可以找出如何使用包含空格的路径
回答by chindo
Solution in:How do I set the eclipse.ini -vm option?
-vm C:\\bin
-vm C:\\bin
-vm
C:\<java_path>\bin
Must be the first thing in eclipse.ini
必须是eclipse.ini中的第一件事
回答by Davut Gürbüz
All above answers didn't work for me. My Eclipse mars is x64 but I need to set registry dll to x86 for another software.
以上所有答案对我都不起作用。我的 Eclipse mars 是 x64,但我需要将另一个软件的注册表 dll 设置为 x86。
At the end I put -vm argument at the end of shortcut and this did the trick.
最后,我将 -vm 参数放在快捷方式的末尾,这起到了作用。
D:\mars\eclipse\eclipse.exe -vm "C:\Program Files\Java\jre7\bin\server\jvm.dll"
D:\mars\eclipse\eclipse.exe -vm "C:\Program Files\Java\jre7\bin\server\jvm.dll"
According to this docjvm.dll also work for some cases.
根据这个文档jvm.dll 也适用于某些情况。
回答by KayV
if you are using mac, proceed with following steps:
如果您使用的是 mac,请继续执行以下步骤:
Move to following directory:
/sts-bundle/STS.app/Contents/Eclipse
Add the java home explicitly in STS.ini file:
-vm /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin -vmargs
移动到以下目录:
/sts-bundle/STS.app/Contents/Eclipse
在 STS.ini 文件中显式添加 java home:
-vm /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin -vmargs
Make sure not to addall the statements in single line
确保不要在一行中添加所有语句