1.cmd进入命令行
2.cd到项目的classes目录如(F:\workspace\portal\build\classes)
3.将该目录下打成jar文件输入:jar -cvf name.jar*
4.cd到项目的lib目录
5.查看引用的jar文件输入:dir
6.选中引用的jar文件并按回车复制,粘贴到XXX.bat文件中
7.将name.jar写到XXX.bat文件
8.在.bat文件第一行写【 set CP=. 】
9.在每个jar前加【 set CP=%CP%;.\ 】
10.在最后一行写测试类 (如:java -cp %CP%com.neusoft.ita.dpp.test.MainTest
11.新建文件夹将lib下的jar文件,生成的name.jar文件和XXX.bat文件复制该文件夹
12.双击XXX.bat文件测试
XXX.bat文件示例(根据自己情况编写):
set CP=.
set CP=%CP%;.\activation-1.1.jar
set CP=%CP%;.\aopalliance-1.0.jar
set CP=%CP%;.\bcprov-jdk15-133.jar
set CP=%CP%;.\bcprov-jdk15-145.jar
setCP=%CP%;.\com.springsource.net.sf.cglib-2.2.0.jar
setCP=%CP%;.\com.springsource.org.apache.commons.logging-1.1.1.jar
setCP=%CP%;.\com.springsource.org.apache.log4j-1.2.15.jar
setCP=%CP%;.\com.springsource.org.aspectj.tools-1.6.6.RELEASE.jar
setCP=%CP%;.\com.springsource.org.quartz-1.6.2.jar
set CP=%CP%;.\commons-attributes-api-2.1.jar
set CP=%CP%;.\commons-beanutils-1.7.0.jar
set CP=%CP%;.\commons-beanutils-1.8.3.jar
setCP=%CP%;.\commons-beanutils-core-1.8.3.jar
set CP=%CP%;.\commons-codec-1.3.jar
set CP=%CP%;.\commons-collections-3.2.1.jar
set CP=%CP%;.\commons-dbcp-1.2.2.jar
set CP=%CP%;.\commons-discovery-0.2.jar
set CP=%CP%;.\commons-fileupload-1.2.2.jar
set CP=%CP%;.\commons-httpclient-3.0.jar
set CP=%CP%;.\commons-io-2.1.jar
set CP=%CP%;.\commons-lang-2.5.jar
set CP=%CP%;.\commons-logging-1.0.4.jar
set CP=%CP%;.\commons-logging-1.1.1.jar
set CP=%CP%;.\commons-net-1.4.1.jar
set CP=%CP%;.\commons-pool-1.4.jar
set CP=%CP%;.\cxf-2.6.0.jar
set CP=%CP%;.\cxf-manifest.jar
setCP=%CP%;.\cxf-services-sts-core-2.6.0.jar
set CP=%CP%;.\cxf-services-wsn-api-2.6.0.jar
setCP=%CP%;.\cxf-services-wsn-core-2.6.0.jar
set CP=%CP%;.\cxf-xjc-boolean-2.6.0.jar
set CP=%CP%;.\cxf-xjc-bug671-2.6.0.jar
set CP=%CP%;.\cxf-xjc-dv-2.6.0.jar
set CP=%CP%;.\cxf-xjc-runtime-2.6.0.jar
set CP=%CP%;.\cxf-xjc-ts-2.6.0.jar
set CP=%CP%;.\db2java.jar
set CP=%CP%;.\db2jcc.jar
set CP=%CP%;.\db2jcc_javax.jar
set CP=%CP%;.\db2jcc_license_cisuz.jar
set CP=%CP%;.\db2jcc_license_cu.jar
set CP=%CP%;.\dom4j-1.6.1.jar
set CP=%CP%;.\EnvProCommon.jar
set CP=%CP%;.\ezmorph-1.0.6.jar
set CP=%CP%;.\geronimo-activation_1.1_spec-1.1.jar
setCP=%CP%;.\geronimo-annotation_1.0_spec-1.1.1.jar
setCP=%CP%;.\geronimo-javamail_1.4_spec-1.7.1.jar
setCP=%CP%;.\geronimo-jaxws_2.2_spec-1.1.jar
setCP=%CP%;.\geronimo-jms_1.1_spec-1.1.1.jar
set CP=%CP%;.\geronimo-servlet_2.5_spec-1.1.2.jar
setCP=%CP%;.\geronimo-servlet_3.0_spec-1.0.jar
setCP=%CP%;.\geronimo-stax-api_1.0_spec-1.0.1.jar
setCP=%CP%;.\geronimo-ws-metadata_2.0_spec-1.1.3.jar
set CP=%CP%;.\httpclient-4.1.2.jar
set CP=%CP%;.\httpclient-cache-4.1.2.jar
set CP=%CP%;.\httpcore-4.1.2.jar
set CP=%CP%;.\httpmime-4.1.2.jar
set CP=%CP%;.\jakarta-oro-2.0.8.jar
set CP=%CP%;.\jaxb-api-2.0.jar
set CP=%CP%;.\jaxb-impl-2.0.1.jar
set CP=%CP%;.\jaxb-xjc-2.0.1.jar
set CP=%CP%;.\jaxen-1.1-beta-6.jar
set CP=%CP%;.\jaxen-1.1-beta-9.jar
set CP=%CP%;.\jaxws-api-2.0.jar
set CP=%CP%;.\jdom-1.0.jar
set CP=%CP%;.\jetty-6.1.2rc0.jar
set CP=%CP%;.\jetty-util-6.1.2rc0.jar
set CP=%CP%;.\jmock-1.0.1.jar
set CP=%CP%;.\jms-1.1.jar
set CP=%CP%;.\js-1.7R2.jar
set CP=%CP%;.\json-lib-2.3-jdk15.jar
set CP=%CP%;.\jsr173_api-1.0.jar
set CP=%CP%;.\jsr311-api-1.1.1.jar
set CP=%CP%;.\junit-3.8.1.jar
set CP=%CP%;.\mail-1.4.jar
set CP=%CP%;.\mimepull-1.7.jar
set CP=%CP%;.\msv-core-2011.1.jar
set CP=%CP%;.\mysql-connector-java-5.1.18-bin.jar
set CP=%CP%;.\neethi-3.0.2.jar
set CP=%CP%;.\oauth-20100527.jar
set CP=%CP%;.\oauth-provider-20100527.jar
set CP=%CP%;.\ojdbc14.jar
set CP=%CP%;.\opensaml-1.0.1.jar
set CP=%CP%;.\opensaml-2.5.1-1.jar
set CP=%CP%;.\openws-1.4.2-1.jar
set CP=%CP%;.\org.springframework.aop-3.0.2.RELEASE.jar
setCP=%CP%;.\org.springframework.asm-3.0.2.RELEASE.jar
setCP=%CP%;.\org.springframework.beans-3.0.2.RELEASE.jar
setCP=%CP%;.\org.springframework.context-3.0.2.RELEASE.jar
set CP=%CP%;.\org.springframework.core-3.0.2.RELEASE.jar
setCP=%CP%;.\org.springframework.expression-3.0.2.RELEASE.jar
setCP=%CP%;.\org.springframework.web-3.0.2.RELEASE.jar
set CP=%CP%;.\out.txt
set CP=%CP%;.\pinyin4j-2.5.0.jar
set CP=%CP%;.\name.jar (这里是在F:\workspace\portal\build\classes生成的jar)
set CP=%CP%;.\relaxngDatatype-20020414.jar
set CP=%CP%;.\run.bat
set CP=%CP%;.\saaj-api-1.3.4.jar
set CP=%CP%;.\saaj-api-1.3.jar
set CP=%CP%;.\saaj-impl-1.3.18.jar
set CP=%CP%;.\saaj-impl-1.3.jar
set CP=%CP%;.\serializer-2.7.1.jar
set CP=%CP%;.\servlet-api-2.3.jar
set CP=%CP%;.\servlet-api-2.5-6.1.2rc0.jar
set CP=%CP%;.\slf4j-api-1.6.2.jar
set CP=%CP%;.\slf4j-jdk14-1.6.2.jar
set CP=%CP%;.\spring-1.2.6.jar
set CP=%CP%;.\stax-api-1.0.1.jar
set CP=%CP%;.\stax-utils-20040917.jar
set CP=%CP%;.\stax2-api-3.1.1.jar
set CP=%CP%;.\velocity-1.7.jar
set CP=%CP%;.\wlclient.jar
set CP=%CP%;.\woodstox-core-asl-4.1.2.jar
set CP=%CP%;.\wsdl4j-1.6.1.jar
set CP=%CP%;.\wsdl4j-1.6.2.jar
set CP=%CP%;.\wss4j-1.5.1.jar
set CP=%CP%;.\wstx-asl-3.2.0.jar
set CP=%CP%;.\xalan-2.7.1.jar
set CP=%CP%;.\xbean-2.2.0.jar
set CP=%CP%;.\xbean-spring-2.8.jar
set CP=%CP%;.\xercesImpl-2.6.2.jar
set CP=%CP%;.\xfire-all-1.2.6.jar
set CP=%CP%;.\xfire-jsr181-api-1.0-M1.jar
set CP=%CP%;.\xml-apis-1.0.b2.jar
set CP=%CP%;.\xml-resolver-1.2.jar
set CP=%CP%;.\xmlbeans-2.5.0.jar
set CP=%CP%;.\xmlschema-core-2.0.2.jar
set CP=%CP%;.\xmlsec-1.3.0.jar
set CP=%CP%;.\xmlsec-1.5.1.jar
set CP=%CP%;.\xmltooling-1.3.2-1.jar
set CP=%CP%;.\xsdlib-2010.1.jar
java -cp %CP%com.neusoft.ita.dpp.test.MainTest