Ross Gardler wrote: > On 23/04/07, Cyriaque Dupoirieux <[EMAIL PROTECTED]> wrote: >> le 23/04/2007 12:43 Ross Gardler a écrit : >> > It is not necessarily a path problem, since this is a windows platform. >> > >> > Windows has a java.exe in one of the system directories. That needs to >> > be removed in order for windows to find the java instance you want it >> > to use. If you remove it you need to make sure your JAVA_HOME/bin is >> > also in the path environment variable. >> Haa, you see that you also talk about the Path ;-) . > > Yes, but the gotcha is that you can have JAVA_HOME in your path but > windows will still use the one it wants to (i.e. the one in the system > directory). > > Therefore, your path can be correctly set, but the bahaviour is not as > you desire.
Things might look complicated but that's alright, because they really are. When Java (JDK or JRE) is installed on Windows the relevant files are put into the desired target directory. But the installer also puts a copy of java.exe and javaw.exe into C:\WINDOWS\system32 (or whatever your system root is). These executables are the same as in the installation directory. When invoked, these executables check if they are in a directory that looks like a JDK or JRE installation. If yes, it is used. Otherwise the executables looks into the registry, somewhere below HKEY_LOCAL_MACHINE\JavaSoft\Java Runtime Environment. There's a value CurrentVersion that tells the executable which Java version to use, and subkeys with the respective versions. These contain the location of the installation involved. If the path to the JDK/JRE bin is put into PATH it depends if C:\WINDOWS\system32 comes before or after it which java.exe is actually invoked. Now, that's if you call "java" on the command line. If you go through ant.bat things look different. Here's the relevant snippet. <snip> :checkJava set _JAVACMD=%JAVACMD% if "%JAVA_HOME%" == "" goto noJavaHome if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe goto checkJikes :noJavaHome if "%_JAVACMD%" == "" set _JAVACMD=java.exe </snip> So, you can explicitly specify a Java with the environment variable JAVACMD. More important, if JAVA_HOME is set %JAVA_HOME%\bin\java.exe is invoked. If you got here without shortcut you should know which Java was invoked. Forrest uses Ant under the hood, which has some diagnostics information available. Try: forrest -diagnostics You'll see lots of information, the relevant part for now are the System properties. ... ------------------------------------------- System properties ------------------------------------------- java.runtime.name : Java(TM) 2 Runtime Environment, Standard Edition sun.boot.library.path : C:\Program Files\Java\jdk1.4.2\jre\bin java.vm.version : 1.4.2_13-b06 java.vm.vendor : Sun Microsystems Inc. java.vendor.url : http://java.sun.com/ ... java.home : C:\Program Files\Java\jdk1.4.2\jre ... That's the Java that Forrest runs in the front (Ant). As things currently stand, this is most likely the Java version that runs your Forrest backend too. If you *really* want to know, run "forrest -d site". Prepare for a lot of output, and watch for this close to the end: <snip> Note that there are various reasons for "build failed" messages. * Cocoon will report the status of each document: - in column 1: *=okay X=brokenLink ^=pageSkipped (see FAQ). * Even if only one link is broken, you will still get "failed". * Your site would still be generated, but some pages would be broken. * Please check the file: C:\tmp\build\tmp\brokenlinks.xml for any broken links in the generated site. Executing 'C:\Program Files\Java\jdk1.4.2\jre\bin\java.exe' with arguments: </snip> Now that's the Java that drives your site. Hope it helps, Ron