48

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?

manfcas
  • 1,933
  • 7
  • 28
  • 47
Persimmonium
  • 15,593
  • 11
  • 47
  • 78
  • it is not the best solution, but what about saving a backup of eclipse.ini into a txt file, let's say, and comment that one. I don't really think you can comment the ini file – Andrei Sfat May 26 '11 at 11:04
  • I cannot edit my previous comment. Update: on Wikipedia it is said that ini files on windows comments are made using semicolons (;) – Andrei Sfat May 26 '11 at 11:11
  • 1
    Rather late comment, but I ran into the same question and seems only # works for me on Linux. Semicolons cause error. – 4e6 Nov 22 '11 at 13:48
  • On Windows `;` doesn't work. With `#` it's OK. – manfcas Mar 25 '13 at 10:46

5 Answers5

50

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

sazzad
  • 5,740
  • 6
  • 25
  • 42
dunni
  • 43,386
  • 10
  • 104
  • 99
  • 1
    Only # works on Windows 8.1 with Eclipse Luna (RC2). Also, I found that comments started with # must be on their own eclipse.ini lines - i.e. end of line comments result in Eclipse startup failure. – Mark A. Fitzgerald Jul 15 '14 at 12:24
  • As 4e6 noted above, # works on Linux. I tested it with Eclipse Kepler. – Alan Mar 18 '15 at 21:25
8

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
garfbradaz
  • 3,424
  • 7
  • 43
  • 70
Thomas K.
  • 81
  • 1
  • 2
1

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

Ardemius
  • 380
  • 4
  • 14
0

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

0

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

; not working in Ubuntu / Linux Mint.

budo
  • 74
  • 3