[ http://issues.apache.org/jira/browse/DERBY-1597?page=comments#action_12425010 ] Ramandeep Kaur commented on DERBY-1597: ---------------------------------------
Actually, after thinking about it more, I am proposing the following solution:- Give classpath while invoking java classes as following: "%JAVA_HOME%/bin/java" -cp %MYCLASSPATH% org.apache.derby.tools.ij Where MYCLASSPATH will include derby jar files along with system classpath appended to it. Will submit patch. > Scripts in frameworks direcotry needs to be revisted to set up CLASSPATH > properly > --------------------------------------------------------------------------------- > > Key: DERBY-1597 > URL: http://issues.apache.org/jira/browse/DERBY-1597 > Project: Derby > Issue Type: Bug > Components: Demos/Scripts > Affects Versions: 10.2.0.0 > Reporter: Ramandeep Kaur > Assigned To: Andrew McIntyre > > Need to revisit scripts in directory frameworks/embedded/bin and > frameworks/NetworkServer/bin for setting up CLASSPATH properly. The current > problem is as following: > If user already has a CLASSPATH set on their system, the CLASSPATH is not set > again within the script. Therefore, there are no derby classes in the > CLASSPATH which results in java command failing as it can not find the derby > class it is calling. Basically, to make the scripts work, user has to either > issue command "set CLASSPATH=" or have derby jar files be appended to their > system CLASSPATH before running any frameworks batch script. > In ksh scripts, there is same problem except that the user has to issue > command "export CLASSPATH=" or have derby jar files be appended to their > system CLASSPATH only once as whatever CLASSPATH is set up by scripts is not > visible once the script is done. > So I am proposing the following solution so that frameworks scripts work > properly without interfering with system classpath or without any setup from > user. > In batch scripts:- > ---------------------- > 1. Before line "call > "%DERBY_INSTALL%"/frameworks/embedded/bin/setEmbeddedCP.bat", save the > current classpath as follows: > set SAVED_CLASSPATH=%CLASSPATH% > 2. Replace the following lines: > @if !"%CLASSPATH%"==! call > "%DERBY_INSTALL%"/frameworks/embedded/bin/setEmbeddedCP.bat > @if "%CLASSPATH%" == "" call > "%DERBY_INSTALL%"/frameworks/embedded/bin/setEmbeddedCP.bat > with > call "%DERBY_INSTALL%"/frameworks/embedded/bin/setEmbeddedCP.bat > Note: I have given the above as example only. The name of script that is > getting called may be different. > 3. At the end of script, reset the CLASSPATH to system CLASSPATH as follows: > set CLASSPATH=%SAVED_CLASSPATH% > In korn scripts:- > ---------------------- > In ksh script, even though system classpath is only modified within the > script and is not effective once script exits, to be consistent with batch > scripts, do the following: > 1. Before line ". "$DERBY_HOME"/frameworks/embedded/bin/setEmbeddedCP.ksh" > save the current classpath as follows: > export SAVED_CLASSPATH=$CLASSPATH > 2. Replace the following lines: > [ -z "$CLASSPATH" ] && { > . "$DERBY_HOME"/frameworks/embedded/bin/setEmbeddedCP.ksh > } > with > . "$DERBY_HOME"/frameworks/embedded/bin/setEmbeddedCP.ksh > Note: I have given the above as example only. The name of script that is > getting called may be different. > 3. At the end of script, reset the CLASSPATH to system CLASSPATH as follows: > export CLASSPATH=$SAVED_CLASSPATH -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira