Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Java in General and the fly likes Java accessing windows properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java accessing windows properties" Watch "Java accessing windows properties" New topic

Java accessing windows properties

Kevin Fonner

Joined: Sep 20, 2001
Posts: 21
From my java program I need to access what users are on the system, where their default document storage is located, and things like this.
Any suggestions on what the best way to do this is in java?
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
In short, you can't get this info directly from Java.
The info you are wanting is most likely stored somewhere in the windows registry, and to access the registry from Java, you need to use jni.
So, first off, figure out where in the registry, this data is found (ie, which HKEY_CURRENT_USER\..., blah blah, path contains info such as "My Documents" folder etc).
Next read up on jni
Find yourself a c/c++ compiler (theres a good free one at, called dev-c++, or Borland offers a free commandline c++ compiler too.
Probably the most difficult thing about this, is actually knowing where in the registry the values are kept, the Java/jni coding to access the registry isn't so bad.
Good luck.
[ February 24, 2003: Message edited by: James Swan ]
Have you tried LearnNowOnline?
subject: Java accessing windows properties