是否可以向 eclipse.ini 文件添加注释
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6137429/
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
Is it possible to add comments to eclipse.ini file
提问by Persimmonium
I wanted to comment some custom parameters I am using now, to remember why they are there the next time I edit it.
我想评论一些我现在正在使用的自定义参数,以记住为什么我下次编辑它们时它们会在那里。
But I cannot find any reference to comments in this file. Only this, but it is pretty old and hopefully there is a way to add comments now.
但是我在这个文件中找不到任何对评论的引用。只有这个,但它已经很旧了,希望现在有一种添加评论的方法。
Somebody knows?
有人知道吗?
采纳答案by dunni
Comments can be marked with semicolon (;
) or hash (#
) (at least on Windows)
注释可以用分号 ( ;
) 或哈希 ( #
)标记(至少在 Windows 上)
回答by Thomas K.
Eclipse 4.5.2on Windows 7, # is working for me.
but be careful, key - value are in separate line in eclipse.ini
and you need to comment out key-value in same time. I added a example.
Windows 7 上的Eclipse 4.5.2,# 对我有用。但要小心,键值在单独的行中eclipse.ini
,您需要同时注释掉键值。我添加了一个例子。
Working
在职的
#-clean
-startup
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
-showlocation
#-vm
#C:/dev/software/jdk1.8.0_121/bin/javaw.exe
-vm
C:/dev/software/jdk1.8.0_131/bin/javaw.exe
Not working
不工作
-vm
#C:/dev/software/jdk1.8.0_121/bin/javaw.exe
C:/dev/software/jdk1.8.0_131/bin/javaw.exe
回答by Ardemius
A little precisionon those comments in eclipse.ini
, at least for Windows (7).
Strangely, using a leading "#" can result in issues with plugins management.
至少对于 Windows (7) 中的那些评论有一点精确。
奇怪的是,使用前导“#”会导致插件管理出现问题。eclipse.ini
Here is an example with the uninstallation of one:
这是一个卸载一个的例子:
An error occurred while uninstalling
session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Uninstall, operand=[R]com.test.myeclipseplugins 1.2.3 --> [R]com.test.myeclipseplugins 1.2.4, action=org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.UninstallBundleAction).
java.net.URISyntaxException: Illegal character in scheme name at index 0: %23C:/Program%20Files/Java/jdk1.8.0_92/bin/javaw.exe
java.net.URISyntaxException: Illegal character in scheme name at index 0: %23C:/Program%20Files/Java/jdk1.8.0_92/bin/javaw.exe
This "%23" character unfortunately is your leading "#".
And the only way to avoid the issue seems to just avoid using comments :(
不幸的是,这个“%23”字符是您的前导“#”。
避免这个问题的唯一方法似乎就是避免使用注释:(
What I do really notlike in this case, is that this "#" doesn't prevent Eclipse from launching(which is the case for other "bad" characters such as ";" or "//"), but thenmakes other features crash with that not so evident stacktrace (when uninstalling a plugin and facing the former stack, would you first think to an issue in eclipse.ini
?)
我做的真的不喜欢在这种情况下,是该“#”并不能阻止Eclipse的发动(这是其他“坏”的字符,如案“;”或“//”),但随后让其他功能崩溃与不那么明显的堆栈跟踪(当卸载插件并面对以前的堆栈时,您会首先想到 中的问题eclipse.ini
吗?)
回答by Stuart Clayton
Thomas, I'm not convinced by your analysis of the problem you experienced, because you don't show the eclipse.ini file that supposedly caused it.
托马斯,我不相信你对你遇到的问题的分析,因为你没有显示可能导致它的 eclipse.ini 文件。
I too have Windows 7 but no problem with "#" in eclipse.ini. If you look at the source of the EquinoxFwConfigFileParser class, you will find it reads an *.ini file with the Java Properties.load(FileInputStream) method. So since "#" works as a comment signal in a Java properties file, it works as one also in eclipse.ini.
我也有 Windows 7,但 eclipse.ini 中的“#”没有问题。如果查看 EquinoxFwConfigFileParser 类的源代码,您会发现它使用 Java Properties.load(FileInputStream) 方法读取 *.ini 文件。因此,由于“#”在 Java 属性文件中用作注释信号,因此它在 eclipse.ini 中也用作注释信号。
But let's look just at the phenomena. *.ini files occur in many places in an eclipse installation, for example the config.ini file in the configuration subdirectory of the installation directory. It starts like this:
但让我们只看现象。*.ini 文件出现在 eclipse 安装的很多地方,例如安装目录的 configuration 子目录中的 config.ini 文件。它是这样开始的:
#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser #Fri Feb 10 15:57:47 CET 2017 org.eclipse.update.reconcile=false ...
It seems unlikely that "#" would work as a comment signal there, but not in eclipse.ini which has the same kind of structure. (We know now that it is just the structure of a Java Properties file.)
“#”似乎不太可能在那里用作注释信号,但在具有相同结构的 eclipse.ini 中则不然。(我们现在知道它只是 Java 属性文件的结构。)
Your error message
你的错误信息
... in scheme name at index 0: %23C:/Program%20Files/Java/jdk1.8.0_92/bin/javaw.exe
might come from some ini with two lines such as the following, that can appear in an eclipse.ini:
可能来自一些带有两行的 ini,如下所示,它们可以出现在 eclipse.ini 中:
-vm #C:/Program Files/Java/jdk1.8.0_92/bin/javaw.exe
"#" is a legal character in Windows file/directory names. The line following "-vm" is expected to be a file name, or rather a URI. If the specified javaw.exe is not found, the eclipse launcher will take one it finds in the PATH environment variable.
“#”是 Windows 文件/目录名称中的合法字符。“-vm”后面的行应该是文件名,或者更确切地说是 URI。如果未找到指定的 javaw.exe,eclipse 启动器将使用它在 PATH 环境变量中找到的一个。
This for example
这例如
-vm #Hello #K:/studevaux/dev_javaver64/jdk8/bin/javaw.exe -vmargs
worked fine to start eclipse - but only, as I realized, because I have a javaw.exe in my system PATH. When I eliminated that, I got an error message:
启动 eclipse 工作正常 - 但正如我意识到的那样,因为我的系统路径中有一个 javaw.exe。当我消除它时,我收到一条错误消息:
回答by budo
In Ubuntu and Linux Mint (Debian based OS) you can add comments with #
在 Ubuntu 和 Linux Mint(基于 Debian 的操作系统)中,您可以添加注释 #
;
not working in Ubuntu / Linux Mint.
;
不适用于 Ubuntu / Linux Mint。