eclipse: overriding user.name in config.ini

蹲街弑〆低调 提交于 2019-12-18 12:01:48

问题


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?


回答1:


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, in Windows, 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.


In Linux, to relay the contents of the shell variable USER to Eclipse, you need to do this:

exec eclipse -clean --launcher.ini shared/eclipse.ini -vmargs -Duser.name=`eval "echo $USER"`



回答2:


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.



来源:https://stackoverflow.com/questions/359351/eclipse-overriding-user-name-in-config-ini

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!