Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I own a .co.uk domain, and I whenever I've dealt with Java-style package naming, I've gone with uk.co.domainname. Once I encountered package that did the following: co.uk.domainname.

Is one of these right, or is it something that's up to the developer's discretion? Is there some sort of convention that deals with this?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

There's no real rule here, just the conventions that Sun created with the com.sun.* packagers. The only real requirement is uniqueness and that the co.uk... convention defines a folder/file structure.

What will be the decider in your case is what name you want for a 'root' folder - 'uk' or 'co'?

share|improve this answer
Thanks, that sounds fair enough. Though having packages with both co.uk.* and uk.co.* in the same project does seem very.. messy. –  Andrey Dec 16 '12 at 10:04
Right - whatever you choose, be consistent. (Not being consistent with package naming can cause real headaches, like java files split into different roots, issues with testing protected methods, etc,) –  Chad Thompson Dec 17 '12 at 4:02
I meant specifically when you have to use a third-party package and it uses co.uk.* while you're using uk.co.*. In which case I guess it's purely cosmetic. –  Andrey Dec 17 '12 at 6:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.