Decrypt
Java-classpath Collection-impl-0.0.1.jar com.ai.toptea.collection.message.DESEncrypt 1efe46638952f577 Dec
Encryption
java-classpath collection-impl-0.0.1.jar com.ai.toptea.collection.message.DESEncrypt 123456 Enc
This article mainly introduces the method of calling Java under the SH batch file in Linux.
The code for Shell programming is as follows:
- #!/bin/bash
- #引入java环境变量
- . /etc/profile
- #取得当前 the directory where the. sh file resides
- dir="$ (CD" $ (dirname "${bash_source[0"} ")" && pwd )"
- #引入class所在的文件夹
- classes= $DIR /classes
- #lib folder
- libs= $DIR /libs
- #将classes和包jar加入classpath, notice that the colon ":" is usedtosplit the
- classpath= $classes : $libs /commons-logging-1.1.jar: $libs /httpclient-4.2.2.jar: $libs /httpcore-4.2.2.jar:
- # Execute Java call procedure in the following format:
- # Java-classpath $classpath main function Class entry
- Java-classpath $classpath cn.cq.shenyun.HttpClientMain #>> " $DIR/javalog.txt"
- echo "shell over." "
The file structure is as follows:
The classes directory is the Java compiled class directory
The jar used to store the Libs directory
startnet.sh launch file for Shell that we started
Method of calling Java under the SH batch file in Linux