4

Possible Duplicate:
Do you really use your reverse domain for package naming in java?

I am a beginner in android programming. I made a few android projects using eclipse.. while I was catching up with some android tutorials I could see everyone using "com" as a starting word of package name. I want to know why, as far as I have known it's just package name but why does everyone start with "com"? Do I have to follow? or is there any specific reason programmatically?

Community
  • 1
  • 1
jazzed28
  • 89
  • 2
  • 7
  • 1
    No. It doesn't need to be. Search for "java package naming conventions" in your favorite engine (there is a Trail that covers just this, IIRC). The standard is "reverse DNS". –  May 07 '12 at 23:33
  • http://stackoverflow.com/questions/166051/how-should-i-name-packages-if-i-dont-have-a-domain-associated-with-me (see other, though) , http://stackoverflow.com/questions/9244146/why-does-android-require-the-package-name-to-have-at-least-two-identifiers (why use in Android/marketplace) –  May 07 '12 at 23:38
  • Not too hard to find a live example in Google Play, like [this one](https://play.google.com/store/apps/details?id=org.jtb.alogcat&feature=search_result) stare with **org**. – yorkw May 07 '12 at 23:52
  • Thanks, I will look up the reference links that you guys provided above. I am just surprised how fast my posts got answer back – jazzed28 May 08 '12 at 00:14

1 Answers1

6

I want to know why, as far as I have known it's just package name but why does everyone start with "com"?

Because the people creating those projects happen to own domain names ending in .com.

Do I have to follow?

No, but you need to ensure that your app's package is unique across the entire Google Play Store (assuming that is how you plan to distribute the app). The easiest way to do that is to create your Java package based upon a domain name that you own and plan to use for marketing the app. Whether that domain name ends in .com or .net or .biz or whatever is up to you.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491