简体   繁体   中英

System.getProperty(“gradle.user.home”) returns null

I have a Java application that retrieves the path of GRADLE HOME . I created a GRADLE_HOME in the "Environment Variables", but System.getProperty("gradle.user.home") returns null . I also created a GRADLE_USER_HOME in the "Environment Variables", but System.getProperty("gradle.user.home") returns null .

Here's the image of the Environment Variables:

在此处输入图片说明

What's wrong? Please help me.

You can pass system property using -D command option

cmd>gradle -Dgradle.user.home=c:/gradle 

You can also resolve env variable

cmd>gradle -Dgradle.user.home=%GRADLE_USER_HOME%

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM