博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java如何获取项目的工作目录
阅读量:6896 次
发布时间:2019-06-27

本文共 1850 字,大约阅读时间需要 6 分钟。

package maptoxml;

public class Tfff {

public static void main(String[] args) {

System.out.println("Java运行时环境版本:"+System.getProperty("java.version"));
System.out.println("Java 运行时环境供应商:"+System.getProperty("java.vendor"));
System.out.println("Java 供应商的URL:"+System.getProperty("java.vendor.url"));
System.out.println("Java安装目录:"+System.getProperty("java.home"));
System.out.println("Java 虚拟机规范版本:"+System.getProperty("java.vm.specification.version"));
System.out.println("Java 类格式版本号:"+System.getProperty("java.class.version"));
System.out.println("Java类路径:"+System.getProperty("java.class.path"));
System.out.println("加载库时搜索的路径列表:"+System.getProperty("java.library.path"));
System.out.println("默认的临时文件路径:"+System.getProperty("java.io.tmpdir"));
System.out.println("要使用的 JIT 编译器的名称:"+System.getProperty("java.compiler"));
System.out.println("一个或多个扩展目录的路径:"+System.getProperty("java.ext.dirs"));
System.out.println("操作系统的名称:"+System.getProperty("os.name"));
System.out.println("操作系统的架构:"+System.getProperty("os.arch"));
System.out.println("操作系统的版本:"+System.getProperty("os.version"));
System.out.println("文件分隔符(在 UNIX 系统中是“/”):"+System.getProperty("file.separator"));
System.out.println("路径分隔符(在 UNIX 系统中是“:”):"+System.getProperty("path.separator"));
System.out.println("行分隔符(在 UNIX 系统中是“/n”):"+System.getProperty("line.separator"));
System.out.println("用户的账户名称:"+System.getProperty("user.name"));
System.out.println("用户的主目录:"+System.getProperty("user.home"));
System.out.println("用户的当前工作目录:"+System.getProperty("user.dir"));
System.out.println("当前的classpath的绝对路径的URI表示法:" + Thread.currentThread().getContextClassLoader().getResource(""));
System.out.println("得到的是当前的classpath的绝对URI路径:"+ Tfff.class.getResource("/"));
System.out.println("得到的是当前类Tfff.class文件的URI目录:"+Tfff.class.getResource(""));

}

}

转载于:https://www.cnblogs.com/chinaifae/p/10189928.html

你可能感兴趣的文章
wamp You don't have permission to access / on this server等问题的解决.
查看>>
【POJ】3071 Football
查看>>
ArcGis 统计方法
查看>>
Resource interpreted as Script but transferred with MIME type text/plain
查看>>
VirtualBox安装及使用说明和虚拟机安装XP系统图文教程
查看>>
【android】优秀的UI资源站点集合
查看>>
iOS 容易引“起循环引用”的三种场景
查看>>
轮播图点击 手势 代码
查看>>
新年札记:自学系统补完计划
查看>>
[Javascript] Gradient Fills on the HTML5 Canvas
查看>>
对CAB文件进行数字签名
查看>>
SQL Server 变更数据捕获(CDC)
查看>>
Starting httpd:Could not reliably determine the server's fully qualified domain name
查看>>
2015第19周一
查看>>
datatables 参数详解(转)
查看>>
[福利]非认证公众帐号也能申请微信连Wi-Fi了
查看>>
什么时候用Application的Context,什么时候用Activity的Context
查看>>
解读ASP.NET 5 & MVC6系列(15):MvcOptions配置
查看>>
东大oj-1591 Circle of friends
查看>>
动态IP无法获取默认网关,显示0.0.0.0的解决办法
查看>>