eclipse中的System.getProperty("user.dir")

来源:互联网 发布:淘宝115会员怎么搜索 编辑:程序博客网 时间:2024/06/09 20:35

eclipse中的System.getProperty("user.dir")


1、在Java Application中,上述中的获取的是Java项目的路径

(1)运行源码

/** *  */package com.you.test;/** * @author YouHaiDong * */public class Property {/** * @param args */public static void main(String[] args) {String path = System.getProperty("user.dir");System.out.println("Java Application项目路径:" + path);}}

(2)运行结果

项目路径:E:\Eclipse\workspace\You

2、在Java Web项目中,获取的是eclipse中的安装目录路径




2 0