2011-11-04 4 views

답변

2

당신은 이걸이

ClassLoader loader = this.getClass().getClassLoader(); 
URL url = loader.getResource("resource name"); 
String[] filePath = null; 
String protocol = url.getProtocol(); 
if(protocol.equals("jar")){ 
    url = new URL(url.getPath()); 
    protocol = url.getProtocol(); 
} 
if(protocol.equals("file")){ 
    String[] pathArray = url.getPath().split("!"); 
    filePath = pathArray[0].split("/",2); 
} 

파일이 필요 = 새로운 파일을 작동 할 수 있습니다 (FilePath를 [1]);

관련 문제