宸ョ▼鎵鍦ㄧ殑璺緞鍦板潃錛?/span>"+projectURL);
3
杈撳嚭緇撴灉錛?br />
1 宸ョ▼鎵鍦ㄧ殑璺緞鍦板潃錛欴:\J2EE\MyEclipse6.0_workspace\mobilenet2.0
綆鍗曡鏄庯細
榪欎釜JAVA APPLICATION鏂囦歡鏄湪mobilenet2.0鐨勫伐紼嬮噷闈紝鏁呮墦鍗板嚭鏉ョ殑鏄伐紼嬫墍鍦ㄨ礬寰勫湴鍧
鍒氬幓csdn鐨勫崥瀹㈢湅浜嗕竴涓嬶紝鍙戠幇鍘熸潵宸茬粡鎬葷粨榪囦竴嬈★紝鐜板湪杞繃鏉?br />
1
2
3
1 銆佸埄鐢?nbsp;System.getProperty() 鍑芥暟鑾峰彇褰撳墠璺緞錛?nbsp;
4
5
System.out.println(System.getProperty("user.dir"));//user.dir 鎸囧畾浜嗗綋鍓嶇殑璺緞
6
7
8
9
2 銆佷嬌鐢?nbsp;File 鎻愪緵鐨勫嚱鏁拌幏鍙栧綋鍓嶈礬寰勶細
10
11
File directory = new File("");// 璁懼畾涓哄綋鍓嶆枃浠跺す
12
13
try
{
14
15
System.out.println(directory.getCanonicalPath());// 鑾峰彇鏍囧噯鐨勮礬寰?nbsp;
16
17
System.out.println(directory.getAbsolutePath());// 鑾峰彇緇濆璺緞
18
19
}catch(Exceptin e)
{}
20
21
22
23
File.getCanonicalPath() 鍜?nbsp;File.getAbsolutePath() 澶х害鍙槸瀵逛簬 new File(".") 鍜?nbsp;new File("..") 涓ょ璺緞鏈夋墍鍖哄埆銆?nbsp;
24
25
26
27
# 瀵逛簬 getCanonicalPath() 鍑芥暟錛?#8220; ." 灝辮〃紺哄綋鍓嶇殑鏂囦歡澶癸紝鑰?#8221; .. “鍒欒〃紺哄綋鍓嶆枃浠跺す鐨勪笂涓綰ф枃浠跺す
28
29
# 瀵逛簬 getAbsolutePath() 鍑芥暟錛屽垯涓嶇” . ”銆?#8220; .. ”錛岃繑鍥炲綋鍓嶇殑璺緞鍔犱笂浣犲湪 new File() 鏃惰瀹氱殑璺緞
30
31
# 鑷充簬 getPath() 鍑芥暟錛屽緱鍒扮殑鍙槸浣犲湪 new File() 鏃惰瀹氱殑璺緞
32
33
34
35
姣斿褰撳墠鐨勮礬寰勪負 C:\test 錛?nbsp;
36
37
File directory = new File("abc");
38
39
directory.getCanonicalPath(); // 寰楀埌鐨勬槸 C:\test\abc
40
41
directory.getAbsolutePath(); // 寰楀埌鐨勬槸 C:\test\abc
42
43
direcotry.getPath(); // 寰楀埌鐨勬槸 abc
44
45
46
47
File directory = new File(".");
48
49
directory.getCanonicalPath(); // 寰楀埌鐨勬槸 C:\test
50
51
directory.getAbsolutePath(); // 寰楀埌鐨勬槸 C:\test\.
52
53
direcotry.getPath(); // 寰楀埌鐨勬槸 .
54
55
56
57
File directory = new File("..");
58
59
directory.getCanonicalPath(); // 寰楀埌鐨勬槸 C:\
60
61
directory.getAbsolutePath(); // 寰楀埌鐨勬槸 C:\test\..
62
63
direcotry.getPath(); // 寰楀埌鐨勬槸 ..
64
65
66
67
鍏充簬System.getProperty鏂規(guī)硶鐨勫弬鏁拌
68
69
70
71

]]>