Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 자바스크립트
- 개발공부
- table
- Vue
- 자바
- jdk
- 리액트
- React
- EXTJS
- 스프링부트
- DATABASE
- 쿼리
- springboot
- component
- javascript
- java
- reactjs
- crud
- Spring
- GIT
- sql
- 컴포넌트
- Intellij
- JS
- mssql
- restapi
- 보안취약점
- 개발
- 데이터베이스
- 스프링
Archives
- Today
- Total
준준의 기록일지
[Java] CLASSPATH , 경로 탐색 본문
"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."
절대경로
this.getClass().getResource("").getPath(); // 현재 자신의 절대 경로
this.getClass().getResource("/").getPath(); // classes 폴더의 최상위 경로
this.getClass().getResource("/com/test/config/config.properties").getPath(); // classes 폴더에서부터 시작하여 해당파일까지의 절대 경로
현재 클래스가 상속되는(부모) 클래스라면 클래스명.class.getResource 로 해야 한다.
getClass()는 실행되는 현재 자신(자식클래스가 될 수 있음)을 가리키기 때문이다.
WEB의 절대경로와 다르다..
new File("").getAbsolutePath() : 절대경로
new File("").getCanonicalPath() : 상대경로
출처 :
java 경로 표시
Java 절대경로 this.getClass().getResource("").getPath(); // 현재 자신의 절대 경로 this.getClass().getResource("/").getPath(); // classes 폴더의 최상위 경로 this.getClass().getResource("/com/test/con..
blog.daum.net