Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

intellij idea module default "user.dir"

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?

like image 969
bluearrow Avatar asked Jun 20 '13 10:06

bluearrow


1 Answers

  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.

like image 176
vikingsteve Avatar answered Oct 18 '22 05:10

vikingsteve