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

在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包的分号换成冒号即可

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

报告相同问题?

悬赏问题

  • ¥30 STM32 INMP441无法读取数据
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥500 把面具戴到人脸上,请大家贡献智慧
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。
  • ¥15 各位 帮我看看如何写代码,打出来的图形要和如下图呈现的一样,急
  • ¥30 c#打开word开启修订并实时显示批注
  • ¥15 如何解决ldsc的这条报错/index error
  • ¥15 VS2022+WDK驱动开发环境