[英]find the executable jar file location in java
Is is possible to find my executable jar file running location, from that jar file jave code, 有可能找到我的可执行jar文件运行位置,从那个jar文件的jave代码,
For example I may run one particular jar file from d:\\test\\finloc.jar, It should print the path as 例如,我可以从d:\\ test \\ finloc.jar运行一个特定的jar文件,它应该打印路径为
d:\\test
I may run from C:\\users\\GJ\\Documents\\findloc.jar, then its output should be like 我可以从C:\\ users \\ GJ \\ Documents \\ findloc.jar运行,然后它的输出应该是
C:\\users\GJ\\Documents\\
Following code outputs the path from where the application starts. 以下代码输出应用程序启动的路径。
In your case, the jar file. 在你的情况下,jar文件。
System.getProperty("user.dir");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.