当前位置: 代码迷 >> J2EE >> linux下执行java命令解决思路
  详细解决方案

linux下执行java命令解决思路

热度:71   发布时间:2016-04-19 22:46:31.0
linux下执行java命令

我今天折腾了1i上午在ubuntu下也没尝试成功。我在windows下编译好的文件拷贝到linux(ubuntu12.04 )下运行,说是jar包没找到异常。各位大侠看看下面的代码,希望给与我指导。而且我jdk都已经配置好了。
java -cp .:..\bagcrawl\commons-codec-1.6.jar:..\bagcrawl\commons-logging-1.1.3.jar:..\bagcrawl\fluent-hc-4.3.3.jar:..\bagcrawl\htmlparser.jar:..\bagcrawl\httpclient-4.3.3.jar:..\bagcrawl\httpclient-cache-4.3.3.jar:..\bagcrawl\httpcore-4.3.2.jar:..\bagcrawl\httpmime-4.3.3.jar:..\bagcrawl\jsoup-1.7.3.jar:..\bagcrawl\mysql-connector-java-5.1.29-bin.jar com.imut.crawl.MyCrawl.MyCrawler

------解决方案--------------------
下面就是个例子,都用绝对路径吧

java -Dfile.encoding=UTF-8 -classpath "/root/interfaces_platform/WEB-INF/classes:/root/interfaces_platform/WEB-INF/lib/activemq-broker-5.8.0.jar:/root/interfaces_platform/WEB-INF/lib/activemq-client-5.8.0.jar:/root/interfaces_platform/WEB-INF/lib/activemq-console-5.8.0.jar:/root/interfaces_platform/WEB-INF/lib/activemq-jaas-5.8.0.jar:/root/interfaces_platform/WEB-INF/lib/activemq-kahadb-store-5.8.0.jar:/root/interfaces_platform/WEB-INF/lib/activemq-openwire-legacy-5.8.0.jar:/root/interfaces_platform/WEB-INF/lib/activemq-protobuf-1.1.jar:/root/interfaces_platform/WEB-INF/lib/activemq-spring-5.8.0.jar:/root/interfaces_platform/WEB-INF/lib/activemq-web-5.8.0.jar:/root/interfaces_platform/WEB-INF/lib/aopalliance-1.0.jar:/root/interfaces_platform/WEB-INF/lib/asm-3.3.jar:/root/interfaces_platform/WEB-INF/lib/cglib-2.2.2.jar:/root/interfaces_platform/WEB-INF/lib/common-annotations.jar:/root/interfaces_platform/WEB-INF/lib/commons-codec-1.7.jar:/root/interfaces_platform/WEB-INF/lib/commons-collections-3.2.1.jar:/root/interfaces_platform/WEB-INF/lib/commons-httpclient-3.1.jar:/root/interfaces_platform/WEB-INF/lib/commons-lang-2.6.jar:/root/interfaces_platform/WEB-INF/lib/commons-logging-1.1.1.jar:/root/interfaces_platform/WEB-INF/lib/cxf-2.3.3.jar:/root/interfaces_platform/WEB-INF/lib/dom4j-1.6.1.jar:/root/interfaces_platform/WEB-INF/lib/geronimo-j2ee-management_1.1_spec-1.0.1.jar:/root/interfaces_platform/WEB-INF/lib/geronimo-jaxws_2.2_spec-1.1.jar:/root/interfaces_platform/WEB-INF/lib/geronimo-jms_1.1_spec-1.1.1.jar:/root/interfaces_platform/WEB-INF/lib/geronimo-servlet_3.0_spec-1.0.jar:/root/interfaces_platform/WEB-INF/lib/hawtbuf-1.9.jar:/root/interfaces_platform/WEB-INF/lib/httpclient-4.2.5.jar:/root/interfaces_platform/WEB-INF/lib/httpcore-4.2.4.jar:/root/interfaces_platform/WEB-INF/lib/javax.ws.rs-api-2.0-m10.jar:/root/interfaces_platform/WEB-INF/lib/jaxb-api-2.2.6.jar:/root/interfaces_platform/WEB-INF/lib/jaxen-1.1.1.jar:/root/interfaces_platform/WEB-INF/lib/jersey-bundle-1.17.1.jar:/root/interfaces_platform/WEB-INF/lib/jetty-continuation-7.2.2.v20101205.jar:/root/interfaces_platform/WEB-INF/lib/jetty-http-7.2.2.v20101205.jar:/root/interfaces_platform/WEB-INF/lib/jetty-io-7.2.2.v20101205.jar:/root/interfaces_platform/WEB-INF/lib/jetty-server-7.2.2.v20101205.jar:/root/interfaces_platform/WEB-INF/lib/jetty-util-7.2.2.v20101205.jar:/root/interfaces_platform/WEB-INF/lib/jta-1.1.jar:/root/interfaces_platform/WEB-INF/lib/junit-3.8.1.jar:/root/interfaces_platform/WEB-INF/lib/jython-standalone-2.5.3.jar:/root/interfaces_platform/WEB-INF/lib/log4j-1.2.16.jar:/root/interfaces_platform/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar:/root/interfaces_platform/WEB-INF/lib/neethi-2.0.4.jar:/root/interfaces_platform/WEB-INF/lib/org.json.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.aop-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.asm-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.aspects-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.beans-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.context-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.context.support-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.core-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.expression-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.jdbc-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.jms-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.orm-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.test-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.transaction-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/org.springframework.web-3.1.0.RELEASE.jar:/root/interfaces_platform/WEB-INF/lib/proxool-0.9.1.jar:/root/interfaces_platform/WEB-INF/lib/proxool-cglib.jar:/root/interfaces_platform/WEB-INF/lib/quartz-all-2.1.3.jar:/root/interfaces_platform/WEB-INF/lib/slf4j-api-1.6.1.jar:/root/interfaces_platform/WEB-INF/lib/slf4j-log4j12-1.6.1.jar:/root/interfaces_platform/WEB-INF/lib/stax2-api-3.1.1.jar:/root/interfaces_platform/WEB-INF/lib/woodstox-core-asl-4.2.0.jar:/root/interfaces_platform/WEB-INF/lib/wscloud-sdk v0.1.9.jar:/root/interfaces_platform/WEB-INF/lib/wsdl4j-1.6.3.jar:/root/interfaces_platform/WEB-INF/lib/xmlschema-core-2.0.3.jar" com.xinnet.interfaces.platform.service.dns.impl.XindnsUtils

  相关解决方案