Search code examples
javapackaging

Java packaging, repeating package name?


I've finally started getting around to packaging my code and I've stumbled upon a strange little situation, I've been using the com.myname.myproduct.* packaging for awhile, but not that I have my website set-up I've been meaning to re-do all of my packaging.

The problem I've come across is that my website uses the .net TLD, and the software contains a .net package for it's networking code.

Is a package name such as

net.product.net

frowned upon by default, or is it perfectly fine?


Solution

  • It's perfectly fine. There are no conflicts. Packages only exist as fully qualified names in Java. There are no "relative path" names; meaning, Java does not have a notion of a "product.net" subpackage under "net", nor a "net" subpackage under "net.product". There are only fully qualified packages like "net.product" and "net.product.net".