Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何找到Java应用程序的安装目录?_Java_Path_Installation_Directory_Classpath - Fatal编程技术网

如何找到Java应用程序的安装目录?

如何找到Java应用程序的安装目录?,java,path,installation,directory,classpath,Java,Path,Installation,Directory,Classpath,我需要找到Java应用程序的安装目录。我将使用它来查找不在类路径上的资源。最好的解决方案是什么?此代码将为您提供类文件在系统中执行的位置 this.getClass().getProtectionDomain().getCodeSource().getLocation();

我需要找到Java应用程序的安装目录。我将使用它来查找不在类路径上的资源。最好的解决方案是什么?

此代码将为您提供类文件在系统中执行的位置

this.getClass().getProtectionDomain().getCodeSource().getLocation();