Change user.home system property

前端 未结 2 493
故里飘歌
故里飘歌 2020-12-09 08:25

How do I change the user.home system property from outside my java program, so that it thinks it\'s a different directory from D:\\Documents and Settings\\%USERNAME%? Via en

2条回答
  •  醉酒成梦
    2020-12-09 09:17

    If you want to set user.home for all Java programs, you can use the special environment variable _JAVA_OPTIONS.

    But note that a difficult to suppress warning message will be printed.

    $ export _JAVA_OPTIONS=-Duser.home=/some/new/dir
    $ java test
    Picked up _JAVA_OPTIONS: -Duser.home=/some/new/dir
    /some/new/dir
    

提交回复
热议问题