daymissing_001 2011-04-08 15:54
浏览 811
已采纳

在linux中执行java.jar时报错

[devafs:/home/devafs/batch/sbin] sh start.sh
Usage: java [-options] class args...
or java [-options] -jar jarfile args...

where options include:
-d32 use a 32-bit data model if available

-d64          use a 64-bit data model if available
-client       to select the "client" VM
-server       to select the "server" VM
-hotspot      is a synonym for the "client" VM  [deprecated]
              The default VM is server, 
              because you are running on a server-class machine.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
              A : separated list of directories, JAR archives,
              and ZIP archives to search for class files.
-D<name>=<value>
              set a system property
-verbose[:class|gc|jni]
              enable verbose output
-version      print product version and exit
-version:<value>
              require the specified version to run
-showversion  print product version and continue
-jre-restrict-search | -jre-no-restrict-search
              include/exclude user private JREs in the version search
-? -help      print this help message
-X            print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
              enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
              disable assertions
-esa | -enablesystemassertions
              enable system assertions
-dsa | -disablesystemassertions
              disable system assertions
-agentlib:<libname>[=<options>]
              load native agent library <libname>, e.g. -agentlib:hprof
                see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
              load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
              load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
              show splash screen with specified image

invalid file (bad magic number): Exec format error
invalid file (bad magic number): Exec format error
invalid file (bad magic number): Exec format error
invalid file (bad magic number): Exec format error
invalid file (bad magic number): Exec format error
Failed to load Main-Class manifest attribute from
/home/devafs/batch/lib/db2jcc.jar

start.sh
#!/bin/sh
export args=""
while [ $# -ne 0 ]
do
export args="$args""$1 "
shift
done
java -Xms512M -Xmx512M -Dfile.encoding=GBK -classpath ../lib/c3p0-0.9.1.2.jar;../lib/commons-beanutils-1.8.0.jar;../lib/commons-digester-2.0.jar;../lib/commons-io-1.4.jar;../lib/commons-lang-2.5.jar;../lib/commons-logging-1.1.1.jar;../lib/db2jcc.jar;../lib/freemarker-2.3.8.jar;../lib/junit-4.8.1.jar;../lib/log4j-1.2.16.jar;../lib/slf4j-api-1.6.1.jar;../lib/slf4j-log4j12-1.6.1.jar;../lib/spring-asm-3.0.4.RELEASE.jar;../lib/spring-core-3.0.4.RELEASE.jar;../lib/topbatch-1.2.jar com.huateng.topafs.frame.BatchRunner $args

描述:代码在doc界面中执行成功,但是在linux下执行则报此错误,请知道的朋友指点。

  • 写回答

1条回答 默认 最新

  • shadabing 2011-04-09 00:27
    关注

    linux 分隔符是冒号: windows分隔符是分号;
    将所以jar包的分号换成冒号即可

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码