我正在使用Jdeveloper 11.1.1.7.0
并开发Oracle adf Web应用程序。 weblogic服务器的默认域名为C:\Users\User\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93\DefaultDomain\
。
它只期望此默认域位置中的所有文件。它不是从项目中读取的。因此,如何更改此行为,以便它可以从项目当前路径读取。
任何人都可以帮助解决这个问题。
答案 0 :(得分:0)
从任何图像文件中获取路径,然后使用该路径设置user.dir。 这里getAbsoluteFile()和getAbsolutePath()起着至关重要的作用。
String path=FacesContext.getCurrentInstance().getExternalContext().getResource("/samp.png").getPath();
File directory = new File(path).getAbsoluteFile();
System.out.println("***directory*" + directory.getAbsolutePath());
if (directory.exists()) {
System.setProperty("user.dir", directory.getAbsolutePath());
}