This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "User Watch "User New topic

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?

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

Joined: Oct 27, 2005
Posts: 20131

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:

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: User's start menu folder
jQuery in Action, 3rd edition