I think boot-jar-path was/is intended to be called only by other  
scripts.
But there's the chance that a user will call it outside of a script -  
hence the line:

    if not defined JAVA_HOME set JAVA_HOME="%TC_INSTALL_DIR%\jre"

Later on I/we added this line:

   set JAVA_HOME="%JAVA_HOME:"=%"

To handle quoting and embedded space issues.

Anyway, I don't think is ever meant to be called outside of a script -  
it was more likely written or refactored out of dso-env for clarity  
(dso-env, btw, is the only script that references it) --- that is also  
likely why there is no setlocal/endlocal pair in boot-jar-path.bat.

We could get rid of the lines of code I mentioned above, OR: fold it  
back-in dso-env so that there's no script in our kit that would appear  
broken when called outside of another script --- but post a JIRA for  
this, so that Fiona, et. al., could weigh-in.


On Apr 9, 2008, at 12:57 PM, Juris Galang wrote:
> I'll take a closer look at what boot-jarpath.bat is doing...
>
> On Apr 9, 2008, at 11:15 AM, Geert Bevin wrote:
>> I can use that, but I'm wondering why boot-jar-path.bat has to set
>> and/or modify the global JAVA_HOME var? I think it would be better in
>> case you use this script to ensure a quoted JAVA_HOME path in any of
>> the other startup script, to maybe use TC_JAVA_HOME that the rest
>> uses. This makes less surprising for people to use dso-env.bat since
>> it only intervenes with TC_* variables and not with JAVA_HOME.
>>
>> On Wed, Apr 9, 2008 at 8:09 PM, Juris Galang <[EMAIL PROTECTED] 
>> > wrote:
>>>>> This line removes all the quotes from the value of JAVA_HOME and  
>>>>> then
>>>>> surrounds it with quotes. This is what makes our scripts work.
>>>>
>>>
>>>
>>> I forgot to add:This is what makes our scripts work when JAVA_HOME
>>> happens to have embedded paths and handed off to our script with  
>>> quotes.
>>> But it also works if it was set without quotes (we end up adding it
>>> ourselves)
>>>
>>>
>>> BTW, I recreated your script:
>>>
>>> @echo off
>>> setlocal
>>> set TC_INSTALL_DIR="c:\foo bar\terracotta-2.7.0-SNAPSHOT"
>>>
>>> set TC_CONFIG_PATH="localhost:9510"
>>> call %TC_INSTALL_DIR%\bin\dso-env.bat -q
>>> set JAVA_OPTS=%TC_JAVA_OPTS% %JAVA_OPTS%
>>> echo
>>> endlocal
>>>
>>> But I've wrapped it in setlocal/endlocal. It seemed to run fine (I  
>>> had
>>> to start the TC server first so I wont get the warnings)
>>> It creates a bootjar and sets the JAVA_OPTS variable to:
>>>
>>> -Xbootclasspath/p:"c:\foo bar\terracotta-2.7.0-snapshot\bin\..\lib 
>>> \dso-
>>> boot\dso-boot-hotspot_win32_160_01.jar" -Dtc.install-root="c:\foo  
>>> bar
>>> \terracotta-2.7.0-snapshot\bin\.." -Dtc.config="localhost:9510"
>>>
>>> Is this what you need?
>>>
>>>
>>>
>>>
>>> On Apr 9, 2008, at 1:57 AM, Geert Bevin wrote:
>>>> Well, the problem here is that I want provide easy instructions for
>>>> people to activate Terracotta on an existing Tomcat installation.  
>>>> The
>>>> setenv.bat approach is what is usually recommended, and it works,
>>>> except for boot-jar-path.bat changing the JAVA_HOME variable that  
>>>> is
>>>> already there. I personally think that those scripts should have no
>>>> side-effects at all on existing environment variables if they're
>>>> called through dso-env.bat. It's also weird that JAVA_HOME is by
>>>> default set in boot-jar-path.bat to the JRE that ships with  
>>>> Terracotta
>>>> for the entire environment, if it wasn't there before. That makes
>>>> using dso-env.bat a lot less appealing.
>>>>
>>>> On Wed, Apr 9, 2008 at 10:43 AM, Juris Galang
>>>> <[EMAIL PROTECTED]> wrote:
>>>>>>
>>>>>> set JAVA_HOME="%JAVA_HOME:"=%"
>>>>>
>>>>>
>>>>> This line removes all the quotes from the value of JAVA_HOME and  
>>>>> then
>>>>> surrounds it with quotes. This is what makes our scripts work.
>>>>> However before we do a call to a 3rd Party script, we remove the
>>>>> quotes from some environment variables (often this includes
>>>>> JAVA_HOME)
>>>>>
>>>>> Anyway, don't change the line above, I'll work with you to make  
>>>>> your
>>>>> script work.
>>>>>
>>>>> For reference, on scripts that work with existing Tomcat
>>>>> installations, look into the tools/sessions/configurator-sandbox
>>>>> directory of a TC installation - and look into the start.bat  
>>>>> script
>>>>> of
>>>>> any of the tomcatx.x directories (except tomcat5.5, which assumes
>>>>> tomcat is installed in the vendors directory of your TC  
>>>>> installation)
>>>>>
>>>>>
>>>>>
>>>
>>>>> On Apr 9, 2008, at 1:28 AM, Geert Bevin wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I've been trying to get Terracotta to work easily on Windows  
>>>>>> with an
>>>>>> existing Tomcat installation. For that I create a setenv.bat  
>>>>>> file in
>>>>>> the bin dir with these instructions:
>>>>>>
>>>>>> set TC_INSTALL_DIR="C:\terracotta-2.7.0-snapshot"
>>>>>> set TC_CONFIG_PATH="localhost:9510"
>>>>>> call %TC_INSTALL_DIR%\bin\dso-env.bat -q
>>>>>> set JAVA_OPTS=%TC_JAVA_OPTS% %JAVA_OPTS%
>>>>>>
>>>>>> With this, Tomcat fails to startup due to an error while running
>>>>>> their
>>>>>> setclasspath.bat file.
>>>>>>
>>>>>> I tracked this down to our boot-jar-path.bat script that always
>>>>>> surrounds an existing JAVA_HOME env variable with double quotes.
>>>>>> This
>>>>>> causes the line
>>>>>>
>>>>>> if not "%JAVA_HOME%" == "" goto gotJdkHome
>>>>>>
>>>>>> to fail in setclasspath.bat.
>>>>>>
>>>>>> Any thoughts? I'm really a novice with windows batch scripts,  
>>>>>> so I'd
>>>>>> appreciate some help here. Personally, I'd remove the following  
>>>>>> line
>>>>>> from boot-jar-path.bat:
>>>>>>
>>>>>> set JAVA_HOME="%JAVA_HOME:"=%"
>>>>>>
>>>>>> ... and then adapt the commands that use JAVA_HOME or any derived
>>>>>> variables to have double quotes.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Geert
>>>>>>
>>>>>> --
>>>>>> Geert Bevin
>>>>>> Terracotta - http://www.terracotta.org
>>>>>> Uwyn "Use what you need" - http://uwyn.com
>>>>>> RIFE Java application framework - http://rifers.org
>>>>>> Music and words - http://gbevin.com
>>>>>> _______________________________________________
>>>>>> tc-dev mailing list
>>>>>> [email protected]
>>>>>> http://lists.terracotta.org/mailman/listinfo/tc-dev
>>>>>
>>>>> _______________________________________________
>>>>> tc-dev mailing list
>>>>> [email protected]
>>>>> http://lists.terracotta.org/mailman/listinfo/tc-dev
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Geert Bevin
>>>> Terracotta - http://www.terracotta.org
>>>> Uwyn "Use what you need" - http://uwyn.com
>>>> RIFE Java application framework - http://rifers.org
>>>> Music and words - http://gbevin.com
>>>> _______________________________________________
>>>> tc-dev mailing list
>>>> [email protected]
>>>> http://lists.terracotta.org/mailman/listinfo/tc-dev
>>>
>>> _______________________________________________
>>> tc-dev mailing list
>>> [email protected]
>>> http://lists.terracotta.org/mailman/listinfo/tc-dev
>>>
>>
>>
>>
>> -- 
>> Geert Bevin
>> Terracotta - http://www.terracotta.org
>> Uwyn "Use what you need" - http://uwyn.com
>> RIFE Java application framework - http://rifers.org
>> Music and words - http://gbevin.com
>> _______________________________________________
>> tc-dev mailing list
>> [email protected]
>> http://lists.terracotta.org/mailman/listinfo/tc-dev
>

_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev

Reply via email to