开发者

Is it possible to add comments to eclipse.ini file

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 k开发者_如何学编程nows?


Comments can be marked with semicolon (;) or hash (#) (at least on Windows)


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

#-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


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:

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 :(

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?)


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:

#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.)

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:

-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.

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:

Error message: no java.exe found to start eclipse


In Ubuntu and Linux Mint (Debian based OS) you can add comments with #

; not working in Ubuntu / Linux Mint.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜