English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Java에서 클래스 경로(classpath)를 가져오는 간단한 방법(추천)

이렇게 보여집니다:

<SPAN style="FONT-SIZE: 18px"> 
System.out.println("++++++++++++++++++++++++"); 
String path = System.getProperty("java.class.path"); 
String path2 = FreeMarkerWriter.class.getProtectionDomain().getCodeSource().getLocation().getPath(); 
String path3 = FreeMarkerWriter.class.getProtectionDomain().getCodeSource().getLocation().getFile(); 
String path4 = Thread.currentThread().getContextClassLoader().getResource("").getPath(); 
System.out.println("path 1 = " + path); 
System.out.println("path 2 = " + path2); 
System.out.println("path 3 = " + path3); 
System.out.println("path 4 = " + path4); 
System.out.println("++++++++++++++++++++++++"); 
</SPAN> 

이제 여기에 있는 이 Java에서 classpath를 얻는 간단한 방법(추천)이 저의 모든 공유 내용입니다. 많은 참고를 기대하며, 많은 지원과 격려를 부탁드립니다. 노래 가이드.

추천하시는