简体   繁体   English

获取执行路径-从我启动jar文件的位置

[英]Get path of execution - from where I start jar file

Can I in my Java app find current path where I start that jar file ? 我可以在Java应用程序中找到我启动该jar文件的当前路径吗?
Path of execution ( example: C:\\test\\test_one> java -jar test.jar to get C:\\test\\test_one ) ? 执行路径(例如: C:\\test\\test_one> java -jar test.jar以获得C:\\test\\test_one )?

You can. 您可以。 Within your code you can call System.getProperty("user.dir") to return the working directory of the application. 在您的代码中,您可以调用System.getProperty(“ user.dir”)以返回应用程序的工作目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM