db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John H. Embretsen (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-620) BUILDING.txt section 3.2(1): Instructions for finding user home directory are not reliable
Date Wed, 12 Oct 2005 22:17:12 GMT
    [ http://issues.apache.org/jira/browse/DERBY-620?page=comments#action_12331931 ] 

John H. Embretsen commented on DERBY-620:

Ant looks for the "ant.properties" file in the directory specified by Java's "user.home" system
property. Since this does not necessarily corespond with %HOME% or $HOME, BUILDING.txt should
be corrected.

On Windows 2000 and XP, the "user.home" directory in most cases corresponds to the environment
variable %USERPROFILE%, which is a concatenation of the variables %HOMEDRIVE% and %HOMEPATH%,
e.g. "C:\Documents and Settings\User".
See http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx.

On Unix/Linux systems, the "user.home" directory in most cases correspond to the $HOME environment
variable (e.g. "/home/username"), but this is not always true, as described above.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4787931 is a bug report that describes
some issues and workarounds related to the way a variety of  JVMs determines "user.home".
On Windows, Java actually tries to determine the user home directory by looking in the registry
for the location of the user's desktop folder, and uses that folder's parent folder as "user.home".
On Unix/Linux systems, Java determines the user's home directory by looking at the user's
entry in the password file, e.g. /etc/passwd.

I suggest changing BUILDING.txt, section 3.2 (1) to something like this:


(1) Determine the directory on your system that corresponds to
    the "user.home" system property of the jvm referred to by
    JAVA_HOME. This directory will be referred to as the 
    ${user.home} directory in the rest of this document. 
    In order to correctly determine the value of ${user.home}, 
    do either of the following:

	a) Run ant diagnostics and look for "user.home" in the
           list of System properties:
	   ant -diagnostics

	b) Write and run a small java program that prints the
           value of the "user.home" system property, e.g. by
           including the following line in the program:

    On most Unix systems, ${user.home} is equivalent to the
    value of the environment variable $HOME or $home.
    On newer Windows systems, ${user.home} is often equivalent
    to the environment variable %USERPROFILE%.


Does anyone have any comments to this suggestion?

> BUILDING.txt section 3.2(1): Instructions for finding user home directory are not reliable
> ------------------------------------------------------------------------------------------
>          Key: DERBY-620
>          URL: http://issues.apache.org/jira/browse/DERBY-620
>      Project: Derby
>         Type: Bug
>   Components: Documentation
>     Versions:,
>  Environment: Windows/Unix/Linux, JDKs 1.3-1.5
>     Reporter: John H. Embretsen
>     Priority: Minor

> BUILDING.txt, section 3.2 states:
> ------------------------------------------------------------------------------------
> 3.2   Create property file
> You will need to create a property file to specify
> your environment and some of your options. Do the following
> to specify your environment and options:
> (1) Find out user home directory on your system. You can find  
>     user home directory by doing echo on variable %HOME% 
>     on windows and $home or $HOME on unix.
> ------------------------------------------------------------------------------------
> In some cases, %HOME% (on WIndows) or $HOME  ($home) (on Unix) does not correspond to
the directory where ant looks for "ant.properties". 
> I recently tried to build Derby on Windows XP, and accidentally put ant.properties in
the wrong directory, causing ant to say that java.lang could not be found. On Windows XP and
2000 (and most likely all older Windows platforms as well) "out-of-the-box", there is no environment
variable called %HOME%. Creating this environment variable manually does not make any difference.
> On Unix systems, the $HOME environment variable does not necessarily always correspond
to ant's (i.e. Java's) interpretation of  "user.home". For example, if a user changes this
variable manually from "/home/username" to "/home/username/myHome", $HOME refers to the latter,
but ant will continue to look for ant.properties in the "/home/username" directory.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message