• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

User's start menu folder

 
Daniel Gen Li
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i get the directory of the user's start menu folder? I know for a fact that I can get the user's home directory by System.getProperty("user.home"), and then add "Start menu" to it, but what if it's not an english system? how would i do it then?
 
Ireneusz Kordal
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Window XP localized folder names are stored in the registry under:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders tree.
The path for 'Menu start" is stored in the key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Start Menu
Java does not provide methods for accessing Windows registry in the standard API, but you can find some free libraries in the net
 
Rob Spoor
Sheriff
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another way is through JNI with a simple API call. First, you'll need constant CSIDL_STARTMENU with value 11 (defined in shlobj.h). Next, you'll need to pass that to SHGetSpecialFolderPath:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic