Question:
Java use URL reading file interpretation error MalformedURLException
1. Malformedurlexception: unknown protocol: F is reported when using URL object to parse the file. It’s quite confusing. Check the URL class source code
It is found that the parameter prefix needs to be “Protocol”, because the parameter I transmitted is a file under a disk. Of course, the drive letter here is not a protocol, so I decided to add it in front
File:///, the whole becomes file:/// F://test.txt
because “file:///” Is a standard general document protocol
2. Here is a knowledge point, that is, the HTTP protocol we usually know. The general path is http://10.0.0.1:port/xxx/xxx ,
Why is the File Protocol ///, The difference is that the file path has no host, that is, the host IP, so it is directly omitted here
Similar Posts:
- FAFAL:No bootable medium found!System halted
- Iframe Cross-port Blocked a frame with origin from accessing a cross-origin frame
- Linux Server: How to Check ECC error check
- [Solved] Git Clone Error: Please make sure you have the correct access rights and the repository exists.
- What are hyperparameters in machine learning?
- [Solved] DOM adds elements to HTML Error: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of typ…
- PHP use$_ SERVER[‘PHP_ Self ‘] to get the current page address and its security issues
- Node uses SSH2 SFTP Client to upload and download FTP files
- org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[HTTP/1.1-8080]]
- [Solved] docker nginx localhost connection refused connect() failed (111: Connection refused)while connecting to upstream