我正在尝试使用 weblogic 中的 WLST 脚本工具,得到以下输出
cd /Users/cris/Oracle/Middleware/Oracle_Home/wlserver/server/bin
Last login: Fri Nov 14 12:53:42 on ttys002
Cristians-MacBook-Pro:~ cris$ cd /Users/cris/Oracle/Middleware/Oracle_Home/wlserver/server/bin
Cristians-MacBook-Pro:bin cris$ ./setWLSEnv.sh
CLASSPATH=/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/tools.jar:/Users/cris/Oracle/Middleware/Oracle_Home/wlserver/server/lib/weblogic_sp.jar:/Users/cris/Oracle/Middleware/Oracle_Home/wlserver/server/lib/weblogic.jar:/Users/cris/Oracle/Middleware/Oracle_Home/wlserver/../oracle_common/modules/net.sf.antcontrib_1.1.0.0_1-0b3/lib/ant-contrib.jar:/Users/cris/Oracle/Middleware/Oracle_Home/wlserver/modules/features/oracle.wls.common.nodemanager_2.0.0.0.jar:
PATH=/Users/cris/Oracle/Middleware/Oracle_Home/wlserver/server/bin:/Users/cris/Oracle/Middleware/Oracle_Home/wlserver/../oracle_common/modules/org.apache.ant_1.9.2/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin:/Users/cris/perl5/perlbrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/cris/Oracle/Middleware/Oracle_Home/wlserver/../oracle_common/modules/org.apache.maven_3.0.5/bin
您的环境已设置完毕。
但看起来路径没有被保留
Cristians-MacBook-Pro:bin cris$ echo $PATH
/Users/cris/perl5/perlbrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
所以我得到:
java weblogic.WLST
Error: Could not find or load main class weblogic.WLST
知道为什么运行 ./setWLSEnv.sh 后未设置 PATH 吗?
谢谢
答案1
该命令./setWLSEnv.sh
在子进程中运行安装脚本;它设置环境变量在那个子流程中,然后退出……变量设置随该子进程一起消失。为了让它做任何有用的事情,你必须运行脚本在当前 shell 进程中使用source
命令或其同义词.
:
. setWLSEnv.sh