Quantcast
Viewing all articles
Browse latest Browse all 40

How to get default location for code signing keys BlackBerry10

By default, code signing keys for blackberry10 are stored in a default location in your system. The default locations of code signing keys vary based on operating system on your computer.

Below is detail about the default location as per different operating system

Windows XP : %HOMEPATH%\Local Settings\Application Data\Research In Motion

Windows Vista and Windows 7 : %HOMEPATH%\AppData\Local\Research In Motion

Mac OS : ~/Library/Research In Motion

HOMEPATH for different operating system is as below:

Windows xp : C:\Documents and Settings\user

Windows Vista and Windows 7 : C:\Users\user

Here below is the java program to get default location of code signing keys

  1. /**
  2.  * Driver class
  3.  * @author Sanjay Jain
  4.  *
  5.  */
  6.  
  7. public class Driver {
  8. public static void main(String[] args) {
  9. try {
  10. String rimDir = getDefaultRIMDirLocation();
  11. System.out.println("Research In Motion Default Directory is:");
  12. System.out.println(rimDir);
  13. } catch (Exception e) {
  14. e.printStackTrace();
  15. }
  16. }
  17.  
  18. private static String getDefaultRIMDirLocation() {
  19. String osName = System.getProperty(Constants.OS_NAME);
  20. String fileSeparator = System.getProperty(Constants.FILE_SEPARATOR);
  21. String osVersion = System.getProperty(Constants.OS_VERSION);
  22. String userHome = System.getProperty(Constants.USER_HOME);
  23. String rimDirectory = Constants.RESEARCH_IN_MOTION;
  24. String dirName = "";
  25. // Check for mac
  26. if (osName.contains(Constants.MAC)) {
  27. dirName = userHome + fileSeparator + Constants.LIBRARY + fileSeparator
  28. + rimDirectory;
  29. } // Check for windows except windows xp
  30. else if (osName.contains(Constants.WINDOWS_VISTA)
  31. || osName.contains(Constants.VISTA)
  32. || osName.contains(Constants.WINDOWS_7)
  33. || osName.contains(Constants.WINDOWS_8)
  34. || osVersion.equals(Constants._6_2)) {
  35. dirName = userHome + fileSeparator + Constants.APP_DATA + fileSeparator
  36. + Constants.LOCAL + fileSeparator + rimDirectory;
  37. }
  38. // For windows xp
  39. else {
  40. dirName = userHome + fileSeparator + Constants.LOCAL_SETTINGS
  41. + fileSeparator + Constants.APPLICATION_DATA + fileSeparator + rimDirectory;
  42. }
  43.  
  44. if (dirName.length() == 0) {
  45. dirName = userHome + fileSeparator + rimDirectory;
  46. }
  47. return dirName;
  48. }
  49. }

  1. /**
  2.  * Constants class for holding all constants
  3.  * @author Sanjay Jain
  4.  *
  5.  */
  6. public class Constants {
  7. static final String APPLICATION_DATA = "Application Data";
  8. static final String LOCAL_SETTINGS = "Local Settings";
  9. static final String APP_DATA = "AppData";
  10. static final String _6_2 = "6.2";
  11. static final String WINDOWS_8 = "Windows 8";
  12. static final String VISTA = "Vista";
  13. static final String WINDOWS_7 = "Windows 7";
  14. static final String WINDOWS_VISTA = "Windows Vista";
  15. static final String LIBRARY = "Library";
  16. static final String MAC = "Mac";
  17. static final String RESEARCH_IN_MOTION = "Research In Motion";
  18. static final String USER_HOME = "user.home";
  19. static final String OS_VERSION = "os.version";
  20. static final String FILE_SEPARATOR = "file.separator";
  21. static final String OS_NAME = "os.name";
  22. static final String LOCAL = "Local";
  23. }

For windows 7  and windows vista output will be as below:

Research In Motion Default Directory is:

C:\Users\user\AppData\Local\Research In Motion

 

For windows xp output will be as below

Research In Motion Default Directory is:

C:\Documents and Settings\user\Local Settings\Application Data\Research In Motion

 

For Mac OS output will be as below:

Research In Motion Default Directory is:

/Users/user/Library/Research In Motion

Your Suggestions Are Always Welcomed.

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 40

Trending Articles