0

When I run the WLST .sh script to set the env as follows why can't I see the updated path when I do echo?

[linbox2 bin]$ ./setWLSEnv.sh 
CLASSPATH=/directory/ols_wls/patch_wlss1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
/directory/ols_wls/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
/directory/ols_wls/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
/directory/ols_wls/patch_ocm1031/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
/directory/ols_wls/jrockit_160_14_R27.6.5-32/lib/tools.jar:
/directory/ols_wls/utils/config/10.3/config-launch.jar:
/directory/ols_wls/wlserver_10.3/server/lib/weblogic_sp.jar:
/directory/ols_wls/wlserver_10.3/server/lib/weblogic.jar:
/directory/ols_wls/modules/features/weblogic.server.modules_10.3.2.0.jar:
/directory/ols_wls/wlserver_10.3/server/lib/webservices.jar:
/directory/ols_wls/modules/org.apache.ant_1.7.0/lib/ant-all.jar:
/directory/ols_wls/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:

PATH=/directory/ols_wls/wlserver_10.3/server/bin:
/directory/ols_wls/modules/org.apache.ant_1.7.0/bin:
/directory/ols_wls/jrockit_160_14_R27.6.5-32/jre/bin:
/directory/ols_wls/jrockit_160_14_R27.6.5-32/bin:
/usr/kerberos/bin:
/usr/local/bin:
/bin:
/usr/bin:
/usr/X11R6/bin:
/usr/java/j2sdk1.4.2_11/bin/bin:
/home/oracle/bin:
/directory/wls_olwcs/jdk160_14_R27.6.5-32/bin:
/directory/ccanywhere81/bin:/directory/oracle/oracle/product/10.2.0/client_1/bin

Your environment has been set.
[linbox2 bin]$ export CLASSPATH 
[linbox2 bin]$ export PATH 
[linbox2 bin]$ echo 
$PATH 
/usr/kerberos/bin:
/usr/local/bin:
/bin:
/usr/bin:
/usr/X11R6/bin:
/usr/java/j2sdk1.4.2_11/bin/bin:
/home/oracle/bin:
/directory/wls_olwcs/jdk160_14_R27.6.5-32/bin:
/directory/ccanywhere81/bin:
/directory/oracle/oracle/product/10.2.0/client_1/bin
[linbox2 bin]$

2 Answers 2

1

This is because you are executing this script. This means that a new shell process is being created, and the variables defined or modified have a scope only in that subshell. The parent process does not inherit child's environment.

Whenever you want to load an variables defined in a given file, you have to source it:

$ source file

or

$ . file
0

You can either copy the CLASSPATH=.... until the end and then into a terminal do

export CLASSPATH=...

Or you can just do the following into a terminal

eval `./setWLSEnv.sh ` # this will set into your environment the CLASSPATH

You can check your environment by doing this

env |grep CLASSPATH # look if it matches on what the ./setWLSEnv.sh sets

You must log in to answer this question.