是否可以向 eclipse.ini 文件添加注释
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
注释可以用分号 (
;
) 或哈希 (#
) 标记(至少在 Windows 上)Comments can be marked with semicolon (
;
) or hash (#
) (at least on Windows)Windows 7 上的 Eclipse 4.5.2,# 对我有用。
但要小心,键值在 eclipse.ini 中位于单独的行中,您需要同时注释掉键值。我添加了一个例子。
工作
不工作
Eclipse 4.5.2 on 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.Working
Not working
对
eclipse.ini
中的这些注释有一点精确,至少对于 Windows (7) 来说是如此。奇怪的是,使用前导“#”可能会导致插件管理出现问题。
下面是一个卸载示例:
不幸的是,这个“%23”字符是您的前导“#”。
避免这个问题的唯一方法似乎就是避免使用注释:(
在这种情况下我真正不做的是,这个“#”不会阻止 Eclipse 启动< /strong> (这是其他“坏”字符的情况,例如“;”或“//”),但是 then 使其他功能因不那么明显的堆栈跟踪而崩溃(卸载插件时)面对前一个堆栈,你首先会想到一个问题
eclipse.ini
?)A little precision on those comments in
eclipse.ini
, at least for Windows (7).Strangely, using a leading "#" can result in issues with plugins management.
Here is an example with the uninstallation of one:
This "%23" character unfortunately is your leading "#".
And the only way to avoid the issue seems to just avoid using comments :(
What I do really not like in this case, is that this "#" doesn't prevent Eclipse from launching (which is the case for other "bad" characters such as ";" or "//"), but then makes 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.ini 文件。
我也有 Windows 7,但 eclipse.ini 中的“#”没有问题。如果您查看 EquinoxFwConfigFileParser 类的源代码,您会发现它使用 Java Properties.load(FileInputStream) 方法读取 *.ini 文件。因此,由于“#”在 Java 属性文件中充当注释信号,因此它在 eclipse.ini 中也充当注释信号。
但让我们只看一下现象。 *.ini 文件出现在 Eclipse 安装中的许多地方,例如安装目录的配置子目录中的 config.ini 文件。它是这样开始的:
“#”似乎不太可能在那里用作注释信号,但在具有相同结构的 eclipse.ini 中则不然。 (我们现在知道它只是 Java 属性文件的结构。)
您的错误消息
可能来自某些具有如下两行的 ini,它们可能出现在 eclipse.ini 中:
"#" is a legal character in Windows 文件/目录名称。 “-vm”后面的行应该是文件名,或者更确切地说是 URI。如果未找到指定的 javaw.exe,Eclipse 启动器将采用在 PATH 环境变量中找到的一个。
例如,这
可以很好地启动 eclipse - 但正如我意识到的那样,只是因为我的系统路径中有一个 javaw.exe 。当我消除它时,我收到一条错误消息:
错误消息:找不到启动 eclipse 的 java.exe
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.
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.
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:
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.)
Your error message
might come from some ini with two lines such as the following, that can appear in an eclipse.ini:
"#" 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.
This for example
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:
Error message: no java.exe found to start eclipse
在 Ubuntu 和 Linux Mint(基于 Debian 的操作系统)中,您可以使用
#
添加注释;
在 Ubuntu / Linux Mint 中不起作用。< /强>In Ubuntu and Linux Mint (Debian based OS) you can add comments with
#
;
not working in Ubuntu / Linux Mint.