Search code examples
javalinuxintellij-ideaiderelative-path

Is there a way to change "home" directory in Intellij?


I'm using intellij Idea, and new to linux So for example, I have a project directory structure below

ProjectFolder  
|--> src  
| | |--> MyCodes.java  
| | |--> hello.txt  

Now, if I want to access hello.txt in MyCodes.java with relative path, I need to use "src/hello.txt", where the "home" directory is the ProjectFolder. However, if I copy my files in src(without src folder) into linux, it would fail to run. Is there a way I can set src as "home", so I can access with relative path simply "hello.txt", and therefore won't fail even after copying to linux? Thanks!


Solution

  • Yes, you can set the Working directory in the Run configuration:

    working directory