博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JAVA路径拼接File.separator
阅读量:4138 次
发布时间:2019-05-25

本文共 235 字,大约阅读时间需要 1 分钟。

File.separator

在Windows中,斜杠用的是正斜杠 \,如C:\Program Files\image

在Linux中,斜杠用的是反斜杠 /,如usr/local/nginx

为了能更好的适配各种系统,在路径拼接的时候可以用File.separator来进行拼接,通过代码来获取系统的分隔符。

import java.io.File;
使用方法如下:Spring path = 'image' + File.separator + 'small.jpg'

转载地址:http://usxvi.baihongyu.com/

你可能感兴趣的文章
Detecting Memory Leaks in Kernel
查看>>
Linux initial RAM disk (initrd) overview
查看>>
HOWTO: Booting from SD card using U-Boot
查看>>
HOWTO: Booting from SD card using U-Boot
查看>>
Timestamping Linux kernel printk output in dmesg for fun and profit
查看>>
file lock in the Linux system
查看>>
Increase the android VM heap size.
查看>>
A successful Git branching model
查看>>
Use ADB to connect phone with Windows 7 over tcp
查看>>
The Four-Way Handshake
查看>>
802.11 Authentication and Association
查看>>
Open System authentication
查看>>
Wireless Operating Modes
查看>>
Wifi Connection
查看>>
802.11 Scan and Discovery
查看>>
RTS/CTS协议 (Both wlan and com are using it)
查看>>
Wireless Ad-Hoc Network – Linux
查看>>
802.11ac and 802.11ad
查看>>
IEEE 802 LAN/MAN Standards Committee
查看>>
AES算法分析与实现
查看>>