
C:\windows\system32\cmd.exe
相对路径:是从当前路径开始的路径,假如当前路径为C:\windows
要描述上述路径,只需输入
system32\cmd.exe
实际上,严格的相对路径写法应为
.\system32\cmd.exe
其中,.表示当前路径,在通道情况下可以省略,只有在特殊的情况下不能省略。
假如当前路径为c:\program files
要调用上述命令,则需要输入
..\windows\system32\cmd.exe
其中,..为父目录。
当前路径如果为c:\program files\common files
则需要输入
..\..\windows\system32\cmd.exe
test|
src
|
t090417
|
test.properties
Read.java
test.properties:
TEST=test
Read.java:
import java.io.FileInputStream
import java.io.FileNotFoundException
import java.io.IOException
import java.util.Properties
public class Read {
public static String TEST
private static Properties loadPropertyFile() throws FileNotFoundException,IOException{
Properties properties = new Properties()
FileInputStream fs = new FileInputStream("src/t090417/test.properties")
properties.load(fs)
return properties
}
public static void loadProperty(){
try{
Properties properties = loadPropertyFile()
TEST = properties.getProperty("TEST")
System.out.println("read from properties: "+TEST)
}catch(Exception e){
e.printStackTrace()
}
}
public static void main(String[] args) {
loadProperty()
}
}
其中用的就是相对路径!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)