aspose file tools*
The moose likes Java in General and the fly likes User's start menu folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "User Watch "User New topic
Author

User's start menu folder

Daniel Gen Li
Ranch Hand

Joined: Jan 02, 2010
Posts: 32
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?


Li
Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
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

Joined: Oct 27, 2005
Posts: 19718
    
  20

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:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: User's start menu folder