views:

2521

answers:

2

I have a multi-user eclipse (3.4) installation with a shared master configuration area. Users need to override user.name with their full name and the usual method (adding -Duser.name=... to eclipse.ini) is not suitable since the override must be per-user. I've tried setting user.name in config.ini (inside each user's configuration directory):

user.name=Luca Tettamanti

but it does work, eclipse still retains the login name. The strange thing is that:

user.foobar=Luca Tettamanti

is correctly picked up. Is it possible to somehow override user.name in this configuration?

+2  A: 

This has been reported before indeed.

Why would you not use use a custom eclipse launcher (a script .cmd), which would modify the eclipse.ini, and then call eclipse.exe ?

That script could retrieve the full name with a comand like:

net user %username% /domain | find /i "full"


That way, your custom launcher would run eclipse with:

eclipse.exe -clean --launcher.ini shared\eclipse.ini -vmargs -Duser.name=%FULL_NAME%

using the shared eclipse.ini, but specifying the user.name value.

VonC
Users cannot write to eclipse.ini, this would defeat the purpose of a shared installation...
Luca Tettamanti
Almost there :) I found 2 solutions:eclipse --launcher.ini user/eclipse.ini (per-user ini file), or:eclipse -vmargs -Duser.name=%FULL_NAME% (note -vmargs)The former allows more customizations, but latter is easier to maintain since there's only one ini file.
Luca Tettamanti
A: 

I'm a little bit unclear as to your intention.

The System property user.name is significant as it should reflect the username of who ever invoked the JVM.

If you're doing this for display purposes, and you have control of the plugin that is consuming it, then you should probably use your own method of discovering the display name.

A custom config.ini or shortcut as described by @VonC would be suitable for this.

jamesh
The main goal is to get a human-readable name for ${user} (templates, SVN commits, etc.). The username is not really meaningful outside the office. OTHO as you say something might rely on user.name being the real username :|
Luca Tettamanti
I'm not sure you can overwrite the user.name system property.
jamesh
You can do that, still I'm wondering if it's a good idea. Nothing is breaking on my setup (for now)...
Luca Tettamanti