IntelliJ Problem with+get current working director

2019-02-08 07:06发布

Here is my maven project structure

ProjectParent
 -Class1
 -Class2
 -Module1 (another sub directory)
 --Module1Class1
 --Module1Class2

Now when I run Module1Class1 from IntelliJ my current working directory is where ProjectParent directory, but when I run Module1Class1 from eclipse, my current working directoru is ProjectParent/Module1 directory.

Why this is different in intellij & how can I change this, so my current directory is always from where my class started execution like in this example 'Module1Class1' directory.

2条回答
唯我独甜
2楼-- · 2019-02-08 07:38

You should edit the template Run/Debug configuration and specify $MODULE_DIR$ variable in the Working directory field.

All the new configurations will inherit this default setting and the variable will be substituted with the directory of the module that you want to run.

There is a feature request to make it the default setting, please vote.

查看更多
时光不老,我们不散
3楼-- · 2019-02-08 07:58

You can edit the working directory from within the run configurations dialog.

查看更多
登录 后发表回答