-2
#!/bin/bash
#echo off
echo -n Enter acl File Location
read acl
echo -n Enter target sql File Location
read sql
cd bin
pwd
java -cp .:../lib/dom4j-1.6.1.jar:../lib/poi-3.8-20120326.jar:../lib/poi-ooxml-3.8-20120326.jar:../lib/poi-ooxml-schemas-3.8-20120326.jar:../lib/stax-api-1.0.1.jar:
.:../lib/xmlbeans-2.3.0.jar com/paywithisis/gateway/utility/XLSXToSQLConverter $acl $sql
cd ..
echo $acl
echo $sql

错误信息:

../lib/xmlbeans-2.3.0.jar: line 1: PK: command not found
../lib/xmlbeans-2.3.0.jar: line 2: Lk¶6: command not found
../lib/xmlbeans-2.3.0.jar: line 3:Kk¶6KAKÛnMETA-INF/MANIFEST.MF}AkÂ@…ï
                                                                           ûæØv“h!7-„Úƒ¶â­¬ÉXÙÙ°: No such file or directory
../lib/xmlbeans-2.3.0.jar: line 3: ¶úï›5: command not found
../lib/xmlbeans-2.3.0.jar: line 4: B¯óÞ: command not found
../lib/xmlbeans-2.3.0.jar: line 4: óÞ¬
                                      5
                                       ¬¶èC㨄‰N¥˜ÓŸÉ¼3Õ¡ŸõâLO¥xöhkµ¸¡³ÏI¦öi›Áª©¼
                                                                                    —Àh,©ÒRHñf,–àüWb®¼älÛ=: command not found
../lib/xmlbeans-2.3.0.jar: line 5: IÏsÖñxjgÛE”à{È™Îuªü´HŸòBŠ¥íZŒU½7Ül=°õ}gKýOÜÕÎy6îÀ?Æ#¼¸ÕWËÝÊÇúµ„#sW: command not found
../lib/xmlbeans-2.3.0.jar: line 5: cµ[œØ:þàPK: command not found
../lib/xmlbeans-2.3.0.jar: line 6: 9k¶6org/PK: No such file or directory
../lib/xmlbeans-2.3.0.jar: line 7: 9k¶6
                                       org/apache/PK: No such file or directory
../lib/xmlbeans-2.3.0.jar: line 8: :k¶6org/apache/xmlbeans/PK: No such file or directory
../lib/xmlbeans-2.3.0.jar: line 9: syntax error near unexpected token `)'
../lib/xmlbeans-2.3.0.jar: line 9: 9k¶6«f)¸}¿'org/apache/xmlbeans/BindingConfig.class•T]OA=Ó.jµˆÈ7*‚вúBŒ I%Å`j©mC$>é2-
                                                                                                                              Ë,n·¦?KäÁÄ€?ÊxgwÅÒ.´¼ÌݽwϹ瞹íï??~x=ŽRƒèGZK1,Ç°ÃÓV&²ï
        å½ýí|9[ÜÊlf÷³Ëû™b1³Çþ”³šÎO¹q(ôæ‰U\Öõmé
4

3 回答 3

4

问题似乎与以下命令有关,该命令分为两部分:

java -cp .:../lib/dom4j-1.6.1.jar:../lib/poi-3.8-20120326.jar:../lib/poi-ooxml-3.8-20120326.jar:../lib/poi-ooxml-schemas-3.8-20120326.jar:../lib/stax-api-1.0.1.jar:
.:../lib/xmlbeans-2.3.0.jar com/paywithisis/gateway/utility/XLSXToSQLConverter $acl $sql

您需要在.:../lib/xmlbeans-2.3.0.jar

否则,shell 会尝试../lib/xmlbeans-2.3.0.jar直接执行,从而导致您看到的错误。

于 2012-04-10T06:34:00.730 回答
2

看起来它正在尝试将JAR 文件作为脚本运行。PKMANIFEST字符串是在压缩的 JAR 文件中找到的字符串。

你可能想检查你的类路径中没有错误的空格(或其他有趣的字符)。

于 2012-04-10T06:30:18.353 回答
0

当我将 java 命令从 bat 文件复制到 sh 文件时,同样的问题发生在我身上。在 Windows 中,类路径分隔符是 ';' 而在linux中,分隔符是':'

于 2018-10-29T21:39:46.857 回答