Domanda

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?

È stato utile?

Soluzione

  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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top