Search code examples
bashbatch-filejenkinsweblogicwlst

What mean java -cp in bash and how to rewrite it in batch


Hello I need to write Batch script to deploy webapp to Weblogic server domain via WLST in Jenkins. In this article Bash script to deploy webapp to Weblogic server domain via WLST written code in bash. I don't understand what mean "/usr/bin/java -cp ***.jar ... " and how to rewrite it in bath script.

#!/bin/bash
HOST_NAME=${1-localhost}
HOST_USER=${2-weblogic}
HOST_PASS=${3-welcome1}
HOST_PORT=${4-7001}
SCRIPT_HOME="$(dirname $(readlink -f $0))"
WL_JAR="${SCRIPT_HOME}/middleware/wlserver_10.3/server/lib/weblogic.jar"
JAM_JAR="myapp.war"

function agentDeployer()
{
 /usr/bin/java -cp ${WL_JAR} weblogic.Deployer -adminurl t3://${HOST_NAME}:${HOST_PORT} -user ${HOST_USER} -password ${HOST_PASS} -targets ${SERVER_LIST} -deploy -upload ${JAM_JAR}
}
agentDeployer

Solution

  • -cp stands for Class Path,you specify the locations of the class needed by the application
    java- cp ==>java will search to find the class files as they are needed by the program.

    You don't need to rewrite in batch script, i mean the command java -cp, because it's the same.

    Good Luck !!