我的合法域名不是合法的 Java 包名 [英] My legal domain name is not a legal Java package name

查看:41
本文介绍了我的合法域名不是合法的 Java 包名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的域名是3DTOPO.com.显然java不允许包域名以数字开头.

The name of my domain name is 3DTOPO.com. Apparently java does not allow package domain names to start with a number.

为什么Java反向域名不遵循与域名相同的规则?我真的不想将我的包命名为 com.threedtopo ....

Why doesn't the Java reverse domain name follow the same rules as domain names do? I really don't want to name my package com.threedtopo....

对于不是我的域名的初学者!其他任何人都可以自由注册和使用该域.而且很别扭,而且不是我公司的名字.

For starters that isn't my domain name! Anyone else would be free to register and use that domain. Besides it is very awkward and not the name of my business.

有人有包名建议吗?

推荐答案

根据 RFC 1912

主机名标签中允许的字符仅为 ASCII字母、数字和-"字符.标签可能不是全部数字,但可能有前导数字(例如 3com.com).标签必须结束并仅以字母或数字开头.参见 [RFC 1035] 和 [RFC1123].(标签最初在 [RFC 1035] 中受到限制,以一封信,据报道,一些较旧的主机仍然存在问题[RFC 1123] 中的放宽.)注意有一些互联网违反此规则的主机名 (411.org, 1776.com).存在感[RFC 1033] 中允许在标签中使用下划线,[RFC 1033] 除外仅供参考,并未定义标准.有在至少一种流行的 TCP/IP 实现,目前拒绝与其中以下划线命名的主机交谈.必须指出的是[1035] 中的语言使得这些规则是自愿的——它们适合那些希望尽量减少问题的人.请注意,Internet 主机名规则也适用于使用的主机和地址在 SMTP 中(请参阅 RFC 821).

Allowable characters in a label for a host name are only ASCII letters, digits, and the `-' character. Labels may not be all numbers, but may have a leading digit (e.g., 3com.com). Labels must end and begin only with a letter or digit. See [RFC 1035] and [RFC 1123]. (Labels were initially restricted in [RFC 1035] to start with a letter, and some older hosts still reportedly have problems with the relaxation in [RFC 1123].) Note there are some Internet hostnames which violate this rule (411.org, 1776.com). The presence of underscores in a label is allowed in [RFC 1033], except [RFC 1033] is informational only and was not defining a standard. There is at least one popular TCP/IP implementation which currently refuses to talk to hosts named with underscores in them. It must be noted that the language in [1035] is such that these rules are voluntary -- they are there for those who wish to minimize problems. Note that the rules for Internet host names also apply to hosts and addresses used in SMTP (See RFC 821).

所以域名前面的允许数字直到 RFC 1123,1989 年.

So the allowing digits at the front of domain names didn't begin until RFC 1123, in 1989.

值得注意的是,他们于 1990 年开始编写 Java.那时以数字开头的域可能并不常见,因此包名似乎类似于主机名.

It's worth noting that they started writing Java in 1990. Domains beginning with numbers probably weren't common by then, so package names seemed analogous to hostnames.

包名不必与域名直接对应.对我来说,域名是临时的——它们可以买卖.包名称的持续时间可能比域名长得多.

Package names don't have to directly correspond to domain names. To me, domain names are temporary - they can be bought and sold. Package names might last much longer than domain names.

无论如何,3com 通过购买另一个域解决了这个问题.;-) 他们将 com.palm.webos 用于某些软件.

For what it's worth, 3com solved it by buying another domain. ;-) They used com.palm.webos for some software.

这篇关于我的合法域名不是合法的 Java 包名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆