9

I am fresh about intellij idea. I just import several projects from eclipse, and it's modules in intellij idea.
I run one main in one module and get file can not found exception. I check the user.dir parameter and find it direct to another module(that module is the first module when I import eclipse projects).

System.out.println(System.getProperty("user.dir"));

I just want set the user.dir to that module directory when I run the main in one module. How to set it?

bluearrow
  • 856
  • 2
  • 11
  • 26

1 Answers1

15
  1. Create a Run/Debug configuration for your Main class (the easiest way is to right-click on it and choose Save 'MyClass.main()').

  2. Now, find your configuration (named after your class) on the main toolbar dropdown and choose Edit Configurations

  3. For VM options, put -Duser.dir=whatever

Alternatively, setting Working directory might be able to help you.

vikingsteve
  • 38,481
  • 23
  • 112
  • 156
  • 4
    Yes, I set the Working directory to $MODULE_DIR$ ,it can give me what I want. I also find set default to this: Run->Edit configurations->Defaults. All the application EXCEPT Run/Debug configuration you create manually will use the default setting. – bluearrow Jun 21 '13 at 02:16