java获取系统帐户信息?
是否可以使用 Java 获取当前帐户信息(在计算机上),例如用户名和个人资料图片?任何帮助将不胜感激,
谢谢, TC
Is it possible to get the current account information (on computer) things like their username and profile picture using Java? any help would be appreciated
thanks,
TC
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
系统帐户信息可通过 Java 的系统属性获得。例如:
System.getProperty("user.name") 将返回运行 java 可执行文件的人的用户名。同样,“user.home”将获取该用户的主目录。有很多属性,如果您想要完整列表,请查看 System.getProperties()。
然而,当你说个人资料图片时,我想知道你是否在谈论网络框架的用户帐户。如果是这样的话,我不知道如何帮助你,因为我不知道你正在使用什么网络框架(就我个人而言,无论如何我都不会提供太多帮助,我不是一个网络专家)。
System account info is available through Java's system properties. For example:
System.getProperty("user.name") will return the username of the person who ran the java executable. Similarly, "user.home" will get that user's home directory. There are many properties, if you want the full list, check out System.getProperties().
However, when you say profile picture, it makes me wonder if you're talking about the user account for a web framework. If that's the case, I'm not sure how to help you, since I don't know what web framework you're using (and personally, I wouldn't be much help in any case, I'm not much of a web expert).
请参阅 http://download.oracle.com/javase/tutorial/essential/ environment/sysprop.html 获取每个操作系统上 JVM 可用的系统属性列表。
然后,您可以使用
String prop = System.getProperty("user.name")
访问属性。据我所知,没有人可以普遍访问任何个人资料图片。可能有特定于操作系统的库。
See http://download.oracle.com/javase/tutorial/essential/environment/sysprop.html for a a list of system properties available to the JVM on every OS.
You can then access a property using
String prop = System.getProperty("user.name")
.There's no universal access to any profile picture that I know of. There might be OS-specific libraries for that.