获取工作目录

文件操作 / 基本操作

import javax.swing.filechooser.*;

//在桌面系统上 
String path = FileSystemView
    .getFileSystemView()
    .getDefaultDirectory()
    .getPath();

//在 Android activity 中
String path = this.getApplicationInfo().dataDir;

//在 Android fragment 中
String path = getContext().getApplicationInfo().dataDir;