Saturday, March 14, 2026
HomeLanguagesJavaDifference Between URI and URN in Java

Difference Between URI and URN in Java

URI stands for Uniform Resource Identifier. It identifies the resource either by name, or by location, or by both. It allows uniform identification of the resources. Here the resource can be anything like documents, images, files, web pages, etc. that can be part of the web architecture. The identifier in the name URI refers to the prominence of the resources, despite the technique used. 

When you are browsing on the internet, you are actually looking up a bundle of web resources. We use the Uniform resource identifiers to define the location of a resource. A URI consists of two things: URL and URN.

URN stands for Uniform Resource Name. It identifies the resources by name in a given name-space. A name-space refers to a group of names or identifiers. It is a subset of URI. URN does not include any protocol. A URN is required to exist globally unique and features global scopes. A URN is an unambiguous way to identify a resource.

Difference Between URI and URN

 URI

URN

It is the superset of URL and URN. It is the subset of URI.
It identifies the recourse by name, location, or both. It identifies the resource by names.
URI is used to distinguish one resource from others regardless of the method used. URN is used to distinguish one resource from others by the globally unique names.

Example:  

https://www.website.com/html/#posts

The above example line completely is referred to as URI whereas the part “www.website.com/html/#posts” of the above example is referred to as a URN.

RELATED ARTICLES

Most Popular

Dominic
32506 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6882 POSTS0 COMMENTS
Nicole Veronica
12005 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12099 POSTS0 COMMENTS
Shaida Kate Naidoo
7011 POSTS0 COMMENTS
Ted Musemwa
7255 POSTS0 COMMENTS
Thapelo Manthata
6967 POSTS0 COMMENTS
Umr Jansen
6956 POSTS0 COMMENTS