Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between file:/, file://, file:///

Tags:

url

Today I saw in a Java application several different approaches to load a file.

  • file:/
  • file://
  • file:///

What is the difference of these three URL beginnings and what is the preferred way of using them?

Thanks a lot Stefan

like image 525
Steve Avatar asked Sep 01 '10 09:09

Steve


People also ask

What is difference between file and directory?

difference between directory and File : A file is any kind of computer document and a directory is a computer document folder or filing cabinet. Show activity on this post. directory is a collection of a the folders and files.

What is the difference between different file systems?

FAT32, exFAT and NTFS are file systems used by Windows Operating System. FAT32 is the oldest one, exFAT is replacement of FAT32 and is compatible on multiple devices. NTFS is the latest file system.

What is difference between file and filename?

A file name is the complete title of a file and file extension. For example, "readme. txt" is a complete file name. A file name may also describe only the first portion of the file.

What is the difference between drive and folder?

Answer: Answer: All the data on your hard drive consists of files and folders. The basic difference between the two is that files store data, while folders store files and other folders. The folders, often referred to as directories, are used to organize files on your computer.


2 Answers

  • file:/ is invalid as far as I know

  • file:// is the prefix for the file protocol

  • file:/// is the prefix for the file protocol, plus a leading / pointing to the root directory of the current drive (On Windows) or the overall root directory (On Linux / Unix).

like image 99
Pekka Avatar answered Oct 16 '22 17:10

Pekka


file:/ is invalid, and shouldn't work file:/// is a shorthand for: file://localhost/ file:// is the recommended method

like image 25
Ayende Rahien Avatar answered Oct 16 '22 18:10

Ayende Rahien