\

해병 코딩

728x90
반응형

2021.03.29 - [JAVA/JAVA(자바)설치 및 툴 이용(ECLIPSE)] - [JAVA] 자바 설치 및 환경 하기 JDK 1.8 버전

 

[JAVA] 자바 설치 및 환경 하기 JDK 1.8 버전

www.oracle.com/kr/java/technologies/javase/javase-jdk8-downloads.html 위 링크 클릭 하면 여기로 온다 각자의 환경에 맞게 설치 하자 나는 윈도우 64 비트 그전 오라클 로그인 필수 1. 다운로든 된거를 실행..

marine1188.tistory.com

개발 환경

Window 10 

JDK 1.8

이클립스 2020_03 버전


현재 작업 위치에 있는 파일 정보 볼수있는 소스 코드 

package ex04.file;

import java.io.*;
import java.util.Date;

public class FileInformation {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		File file = null;
		
		byte[] fileName = new byte[100];
		String strName;
		System.out.println("file name=");// 상대경로
			//절대경로-
		
		try {
			System.in.read(fileName);
			strName = new String(fileName).trim();
			file = new File(strName);
			
			System.out.println("절대 경로 :"+file.getAbsolutePath());
			System.out.println("표준 경로 :"+file.getCanonicalPath());
			System.out.println("최종수정일 :"+new Date(file.lastModified()));
			System.out.println("파일크기 :"+file.length());
			System.out.println("읽기속성  :"+file.canRead());
			System.out.println("쓰기속성 :"+file.canWrite());
			System.out.println("파일경로 :"+file.getPath());
			System.out.println("숨김속성 :"+file.isHidden());
		} catch (Exception e) {
			// TODO: handle exception
		}
		
		
	}

}

 

 

 

내가 원하는 위치에 읽을대 그냥 주소만 같으면 되다 경로 붙쳐널기

 

자신의 경로를 입력

출력 결과

file name=
C:\Users\user\Desktop\th1_java 일자별 정리.txt
절대 경로 :C:\Users\user\Desktop\th1_java 일자별 정리.txt
표준 경로 :C:\Users\user\Desktop\th1_java 일자별 정리.txt
최종수정일 :Thu Apr 08 15:17:06 KST 2021
파일크기 :17084
읽기속성  :true
쓰기속성 :true
파일경로 :C:\Users\user\Desktop\th1_java 일자별 정리.txt
숨김속성 :false

 

 


728x90
반응형

이 글을 공유합시다

facebook twitter googleplus kakaoTalk kakaostory naver band