在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个回答

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐