How to override Classpath? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to override Classpath?

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-08-2013
mohtashims mohtashims is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 24 July 2014, 9:27 AM EDT
Posts: 356
Thanks: 81
Thanked 0 Times in 0 Posts
Display How to override Classpath?

Hi,

When I login to my HP-UX and fire the "set" command I see that the weblogic 9.2 classpath is already set.

However, I wish to override the classpath to weblogic version 10.3

I have a script call setWLSEnv.sh that has the desired classpath.

Thus, in my unix script i write

Code:
 
 
. /tmp/wls103/server/bin/setWLSEnv.sh
java weblogic.version

But this happens to give me the version of weblogic 9.2 which means that the CLASSPATH still remains that of 9.2.

How can I override the CLASSPATH to whichever script that has the CLASSPATH I wish to ?

Last edited by mohtashims; 03-08-2013 at 07:04 AM..
Sponsored Links
    #2  
Old 03-08-2013
Scrutinizer's Avatar
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 27 July 2014, 3:45 PM EDT
Location: Amsterdam
Posts: 9,281
Thanks: 260
Thanked 2,303 Times in 2,066 Posts
Could you post what how CLASSPATH gets set in /tmp/wls103/server/bin/setWLSEnv.sh ?
Sponsored Links
    #3  
Old 03-08-2013
mohtashims mohtashims is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 24 July 2014, 9:27 AM EDT
Posts: 356
Thanks: 81
Thanked 0 Times in 0 Posts
Display

Quote:
Originally Posted by Scrutinizer View Post
Could you post what how CLASSPATH gets set in /tmp/wls103/server/bin/setWLSEnv.sh ?
From PID i extract the path using ps command.

So i get /tmp/wls103/ from grepping pid and I store it in a variable wls_home.

This is how i try to run the setwlsEnv.sh in unix script


Code:
 
. $wls_home/server/bin/setWLSEnv.sh


Last edited by mohtashims; 03-08-2013 at 07:45 AM..
    #4  
Old 03-08-2013
Scrutinizer's Avatar
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 27 July 2014, 3:45 PM EDT
Location: Amsterdam
Posts: 9,281
Thanks: 260
Thanked 2,303 Times in 2,066 Posts
That is not what I asked..
Sponsored Links
    #5  
Old 03-08-2013
mohtashims mohtashims is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 24 July 2014, 9:27 AM EDT
Posts: 356
Thanks: 81
Thanked 0 Times in 0 Posts
Looks like it does set the new CLASSPATH but is not able to override the old CLASSPATH. Thus, it seems like although


Code:
 
echo ${CLASSPATH}
/tmp/bea103/wlserver_10.3/server/lib/weblogic.jar

it takes


Code:
 
/tmp/bea92/wlserver92/server/lib/weblogic.jar

into consideration.
Please help !!
Sponsored Links
    #6  
Old 03-08-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 27 July 2014, 10:58 PM EDT
Location: Saskatchewan
Posts: 18,978
Thanks: 748
Thanked 3,146 Times in 2,951 Posts
We want to see the contents of that file. Without seeing it, we're only guessing at what you've done here.

Did you actually export that variable, or just set it? If you don't export it, it's just a local variable and doesn't get passed into any processes you create.


Code:
VAR=value
export VAR

Sponsored Links
    #7  
Old 03-11-2013
mohtashims mohtashims is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 24 July 2014, 9:27 AM EDT
Posts: 356
Thanks: 81
Thanked 0 Times in 0 Posts
I did paste the contents but for some reason I dont see my post reflected. Posting the contents again


Code:
######################################

WL_HOME="/tmp/bea103/wlserver_10.3"
export WL_HOME

. "${WL_HOME}/common/bin/commEnv.sh"

# Check that the WebLogic classes are where we expect them to be
if [ ! -f "${WL_HOME}/server/lib/weblogic.jar" ]; then
  echo
  echo "The WebLogic Server wasn't found in directory ${WL_HOME}/server."
  echo "Please edit the startWebLogic.sh script so that the WL_HOME"
  echo "variable points to the WebLogic installation directory."

# Check that java is where we expect it to be
elif [ ! -d "${JAVA_HOME}/bin" ]; then
  echo
  echo "The JDK wasn't found in directory ${JAVA_HOME}."
  echo "Please edit the startWebLogic.sh script so that the JAVA_HOME"
  echo "variable points to the location of your JDK."

else

CLASSPATH="${WEBLOGIC_CLASSPATH}${CLASSPATHSEP}${CLASSPATH}"
export CLASSPATH

# Import extended environment

if [ -f extEnv.sh ]; then
  . extEnv.sh
fi
if [ ! -z "${EXT_PRE_CLASSPATH}" ]; then
  CLASSPATH="${EXT_PRE_CLASSPATH}${CLASSPATHSEP}${CLASSPATH}"
fi
if [ ! -z "${EXT_POST_CLASSPATH}" ]; then
  CLASSPATH="${CLASSPATH}${CLASSPATHSEP}${EXT_POST_CLASSPATH}"
fi

if [ ! -z "${EXT_PRE_PATH}" ]; then
  PATH="${EXT_PRE_PATH}${PATHSEP}${PATH}"
fi
if [ ! -z "${EXT_POST_PATH}" ]; then
  PATH="${PATH}${PATHSEP}${EXT_POST_PATH}"
fi

# Get PRE and POST environment
if [ ! -z "${PRE_CLASSPATH}" ]; then
  CLASSPATH="${PRE_CLASSPATH}${CLASSPATHSEP}${CLASSPATH}"
fi
if [ ! -z "${POST_CLASSPATH}" ]; then
  CLASSPATH="${CLASSPATH}${CLASSPATHSEP}${POST_CLASSPATH}"
fi

if [ ! -z "${PRE_PATH}" ]; then
  PATH="${PRE_PATH}${PATHSEP}${PATH}"
fi
if [ ! -z "${POST_PATH}" ]; then
  PATH="${PATH}${PATHSEP}${POST_PATH}"
fi

echo CLASSPATH=${CLASSPATH}
echo
echo PATH=${PATH}
echo
echo "Your environment has been set."

fi
#####################################################

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Classpath of JAVA yifangt Programming 1 01-11-2013 06:38 PM
regarding classpath java PRKS Programming 1 12-24-2009 03:38 AM
Classpath Rachel Ross Programming 4 07-19-2008 05:12 PM
Classpath Rachel Ross UNIX for Dummies Questions & Answers 0 07-19-2008 12:13 PM
how to set classpath in cron sari Shell Programming and Scripting 1 04-21-2008 09:48 AM



All times are GMT -4. The time now is 08:21 AM.