0

I have placed BasicAccountRule.drl in my web application at location : C:/workspace/exim_design/src/main/resources/rules/drl/inpatient/BasicAccountRule.drl

Now, I have been using code :

File file = new File ("C:/workspace/exim_design/src/main/resources/rules/drl/inpatient/BasicAccountRule.drl");

This is working fine on my system, but while I am trying to run this code on another system I am getting error : java.io.FileNotFoundException

I know I am getting this error because I have hardcoded file path. And ( C:/workspace/exim_design ) will be different for every system/server.

So, how to make this path dynamic and use inside:

File file = new File () , so that it will run on every machine.

4

1 回答 1

2

您可以在属性文件中设置值并在每个系统上对其进行修改。

您可以设置环境变量。

您可以使用相对路径而不是绝对路径来读取应用程序类路径中的文件。

于 2013-08-14T10:54:04.050 回答