Run the self-developed JAR package on Linux and replace the default JDK. Today, the message sending and receiving platform on Windows is deployed on Linux, which is always incorrect, running java-version is always jdk1.4. the final solution is as follows: www.2cto.com 1: modify the Linux code of the/etc/profile file [root @ localhost server] # vi/etc/profile add JAVA_HOME and PATH at the end of the file to configure the Linux code JAVA_HOME =/weblogic/jdk160_18 PATH = $ JAVA_HOME /bin: $ path classpath =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar export JAVA_HOME export PATH export CLASSPATH 2: run the/etc/profile file and check the version. It is already JDK6 configured above.
Jdk of Weblogic. Www.2cto.com: JDK copied from windows. Check whether it can be used in Linux.
The
The JDK was copied, and the result was miserable for a long time .. Linux code [root @ localhost server] #. /etc/profile [root @ localhost server] # java-version java version "1.6.0 _ 18" Java (TM) SE Runtime Environment (build 1.6.0 _ 18-b07) Java HotSpot (TM) server VM (build 16.0-b13, mixed mode) 4: Configure CLASSPATH for the java class to be executed. Here I have a bunch of external jar packages such as log4j: linux code [root @ localhost server] # export CLASSPATH =.: $ CLASSPATH :. /ipayrelay-server.jar:
./Lib/log4j-1.2.16.jar:./lib/jxl. jar:./lib/commons-beanutils.jar:./lib/commons-collections.
Jar:./lib/commons-digester.jar:./lib/commons-logging.jar:./lib/commons-pool.jar:
./Lib/lucene-core-3.6.1.jar:./lib/mail. jar:./lib/metouia. jar:./lib/QSAdminGUI. jar:./lib
/QuickServer. jar :.
/Lib/quickserver
_ Config. dtd:./lib/quickserver_config.xsd:./lib/QuickServerClient. jar:./lib/ipayrelay
-Client. jar:./lib/
Commons-codec-1.7.jar :. /lib/commons-httpclient-3.1.jar 5: finally run the jar package: Linux code [root @ localhost server] # java-cp $ CLASSPATH com. mfhcd. ipayrelay. server. server 6: make the above content into a script for execution. My script ipayrelay. shJava Code #! /Bin/sh source/etc/profile export CLASSPATH =.: $ CLASSPATH:./ipayrelay-server.jar:./lib/log4j-1.2.16.jar :.
/Lib/jxl. jar:./lib/
Commons-beanutils.jar:./lib/commons-collections.jar:./lib/commons-digester.
Jar :. /lib/commons-logging.jar :. /lib/commons-pool.jar :. /lib/lucene-core-3.6.1.jar :. /lib/mail. jar :. /lib/metouia. jar :. /lib/QSAdminGUI. jar :. /lib/QuickServer. jar :.
/Lib/quickserver _
Config. dtd:./lib/quickserver_config.xsd:./lib/QuickServerClient. jar:./lib/ipayrelay-
Client. jar:./lib/
Commons-codec-1.7.jar:./lib/commons-httpclient-3.1.jar java-cp $ CLASSPATH com. mfhcd. ipayrelay. server. Server #! /Bin/sh is the fixed start of the script for executing the command, and source/etc/profile is the content of the file
Explain it again,
Make JAVA_HOME take effect. Www.2cto.com 7: The script may have a character set problem and needs to be transcoded. After transcoding, it can solve/bin/sh ^ M: bad interpreter.
This error occurs: Linux code [root @ localhost server] # dos2unix ipayrelay. sh 8: Finally, execute the script. grant permissions to the script. I have authorized all the files and Their subfiles in the current directory,
To facilitate calling Java code [root @ localhost server] # chmod-R 777. 9: The final execution Script: Linux code [root @ localhost server] #./ipayrelay. sh