Your path is the concatenation of the system path followed by the user path. Additionally, system environment variables may not contain references to user environment variables, and any such references will not be expanded. To get the desired result, insert the reference to %JAVA_HOME% in the user environment variable PATH, or create such a variable if it doesn't already exist.
Perhaps a simplified example will make this clearer. Suppose the SYSTEM environment is
ProgramFiles = C:\Program Files
SystemRoot = C:\WINDOWS
PATH = %SystemRoot%\SYSTEM32
and the User JSmith's environment is
JAVA_HOME = %ProgramFiles%\Java\bin
USERPROFILE = C:\USERS\JSmith
PATH = %JAVA_HOME%\bin;%USERPROFILE%\bin
then the resulting path would be
C:\WINDOWS\SYSTEM32;C:\Program Files\Java\bin;C:\Users\JSmith\bin
as desired.
Put the 32bit .DLLs into the \Windows\SysWOW64 directory and the 64bit DLLs into the \Windows\system32 directory.
EDIT:
Maybe this helps:
This is just an intelligent guess, but following some investigation I
believe I've found the problem:
If the definition of an environment
variable var1 contains another
environment variable var2 and the name
of var1 is alphabetically less than
the name of var2 (i.e. strcmp(var1,
var2) < 0), then var2 won't get
expanded. This seems to be because
when Windows first sets up the
environment variables, they are
created in alphabetical order, so var2
does not exist until after var1 has
already been created (and so the
expansion can't be done).
I believe this is a limitation in
Windows. Really some sort of
dependency check between the variables
should be carried out so that they are
created in the correct order.
Fortunately, there is a workaround.
1) Enable 'delayed variable expansion'
in the registry (see
http://batcheero.blogspot.com/2007/06/how-to-enabledelayedexpansion.html)
2) Change the '%' signs around var2 to
'!', e.g. "%var2%" becomes "!var2!"
I've done some limited testing on
Windows 7 and this appears to fix the
problem.
It's from here: http://social.answers.microsoft.com/Forums/en-US/vistainstall/thread/48b23109-9fbc-47c5-a5d1-465773f94704
Best Answer
Make
%ProgramFiles%
to%ProgramFiles(x86)%
env variable switching to work for you:Place folders with x32 and x64 versions of OpenSSL library into appropriate
%programfiles%
and%ProgramFiles(x86)%
directories and in thePATH
environment variable, use a reference to these folders via the%programfiles%
variable.This way, when you are running in x32-bit environment, your
PATH
entry%programfiles%/OpenSSL/
will automatically get resolved to%ProgramFiles(x86)%/OpenSSL/
on a disk.